return eval errors too
This commit is contained in:
parent
18c8b36151
commit
68b2cd924c
2 changed files with 11 additions and 9 deletions
Binary file not shown.
|
|
@ -86,7 +86,8 @@ pub fn eval_boolean(s: &str, js_trace: JsValue) -> JsValue {
|
|||
_ => return JsValue::from_str("expected boolean expression (this should never happen)"),
|
||||
};
|
||||
let mut result = Vec::<StateBuddyEvalResultEntry>::new();
|
||||
if let Ok(r) = eval_result {
|
||||
match eval_result {
|
||||
Ok(r) => {
|
||||
r.iter().for_each(|(timestamp, satisfied), | {
|
||||
result.push(StateBuddyEvalResultEntry{
|
||||
timestamp: timestamp.as_millis() as f64,
|
||||
|
|
@ -94,8 +95,9 @@ pub fn eval_boolean(s: &str, js_trace: JsValue) -> JsValue {
|
|||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
return JsValue::from_str("failed to evaluate expression");
|
||||
Err(e) => {
|
||||
return JsValue::from_str(format!("failed to evaluate expression: {}", e).as_str());
|
||||
}
|
||||
}
|
||||
to_value(&StateBuddyEvalResult { entries: result }).expect("fuuuck")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue