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.
20
src/lib.rs
20
src/lib.rs
|
|
@ -86,16 +86,18 @@ pub fn eval_boolean(s: &str, js_trace: JsValue) -> JsValue {
|
||||||
_ => return JsValue::from_str("expected boolean expression (this should never happen)"),
|
_ => return JsValue::from_str("expected boolean expression (this should never happen)"),
|
||||||
};
|
};
|
||||||
let mut result = Vec::<StateBuddyEvalResultEntry>::new();
|
let mut result = Vec::<StateBuddyEvalResultEntry>::new();
|
||||||
if let Ok(r) = eval_result {
|
match eval_result {
|
||||||
r.iter().for_each(|(timestamp, satisfied), | {
|
Ok(r) => {
|
||||||
result.push(StateBuddyEvalResultEntry{
|
r.iter().for_each(|(timestamp, satisfied), | {
|
||||||
timestamp: timestamp.as_millis() as f64,
|
result.push(StateBuddyEvalResultEntry{
|
||||||
satisfied: *satisfied,
|
timestamp: timestamp.as_millis() as f64,
|
||||||
|
satisfied: *satisfied,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
Err(e) => {
|
||||||
else {
|
return JsValue::from_str(format!("failed to evaluate expression: {}", e).as_str());
|
||||||
return JsValue::from_str("failed to evaluate expression");
|
}
|
||||||
}
|
}
|
||||||
to_value(&StateBuddyEvalResult { entries: result }).expect("fuuuck")
|
to_value(&StateBuddyEvalResult { entries: result }).expect("fuuuck")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue