use of il.ac.bgu.cs.bp.bpjs.exceptions.BPjsRuntimeException in project BPjs by bThink-BGU.
the class JsEventSet method contains.
@Override
public boolean contains(BEvent event) {
try {
Object result = predicate.call(Context.getCurrentContext(), predicate, predicate.getParentScope(), new Object[] { Context.javaToJS(event, predicate.getParentScope()) });
Boolean res = (Boolean) Context.jsToJava(result, Boolean.class);
if (res == null) {
throw new RuntimeException("JS Predicate returned null, not a boolean value. " + predicate.toString());
}
return res;
} catch (EvaluatorException ee) {
throw new BPjsRuntimeException("JS Predicate did not return a boolean value.", ee);
} catch (EcmaError ee) {
throw new BPjsRuntimeException("Error evaluating JS Predicate:" + ee.getMessage(), ee);
}
}
Aggregations