Java Code Examples for javax.script.ScriptException#getCause()
The following examples show how to use
javax.script.ScriptException#getCause() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RuleProcessorRuntime.java From streamline with Apache License 2.0 | 6 votes |
private GroovyScript<Boolean> createHelperGroovyScript(GroovyExpression groovyExpression, GroovyScriptEngine groovyScriptEngine) { return new GroovyScript<Boolean>(groovyExpression.asString(), groovyScriptEngine) { @Override public Boolean evaluate(StreamlineEvent event) throws ScriptException { Boolean evaluates; try { evaluates = super.evaluate(event); } catch (ScriptException e) { if (e.getCause() != null && e.getCause() instanceof groovy.lang.MissingPropertyException) { // Occurs when not all the properties required for evaluating the script are set. This can happen for example // when receiving an StreamlineEvent that does not have all the fields required to evaluate the expression LOG.debug("Missing property required to evaluate expression. {}", e.getCause().getMessage()); LOG.trace("",e); evaluates = false; } else { throw e; } } return evaluates; } }; }
Example 2
Source File: SourceExecutableScript.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override public Object evaluate(ScriptEngine engine, VariableScope variableScope, Bindings bindings) { if (shouldBeCompiled) { compileScript(engine); } if (getCompiledScript() != null) { return super.evaluate(engine, variableScope, bindings); } else { try { return evaluateScript(engine, bindings); } catch (ScriptException e) { if (e.getCause() instanceof BpmnError) { throw (BpmnError) e.getCause(); } String activityIdMessage = getActivityIdExceptionMessage(variableScope); throw new ScriptEvaluationException("Unable to evaluate script" + activityIdMessage + ":" + e.getMessage(), e); } } }
Example 3
Source File: Evaluator.java From Latte-lang with MIT License | 5 votes |
public EvalEntry eval(String stmt) throws Exception { try { return (EvalEntry) latteEngine.eval(stmt, latteEngine.getBindings(ScriptContext.ENGINE_SCOPE), new Config() .setScannerType(scannerType).setVarNamePrefix(varNameBase).setEval(true)); } catch (ScriptException e) { throw (Exception) e.getCause(); } }
Example 4
Source File: ErrorHelper.java From purplejs with Apache License 2.0 | 5 votes |
private ProblemException doHandleException( final ScriptException e ) { final ProblemException.Builder builder = ProblemException.newBuilder(); final Throwable cause = e.getCause(); builder.cause( cause != null ? cause : e ); builder.lineNumber( e.getLineNumber() ); builder.path( toResourcePath( e.getFileName() ) ); return builder.build(); }
Example 5
Source File: ScriptLanguageFixture.java From hsac-fitnesse-fixtures with Apache License 2.0 | 5 votes |
protected RuntimeException getExceptionToThrow(ScriptException e) { Throwable cause = e.getCause(); String message; if (cause instanceof ECMAException) { message = cause.toString(); } else { message = e.getMessage(); } return new SlimFixtureException(false, message, e); }
Example 6
Source File: CompiledExecutableScript.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public Object evaluate(ScriptEngine scriptEngine, VariableScope variableScope, Bindings bindings) { try { LOG.debugEvaluatingCompiledScript(language); return getCompiledScript().eval(bindings); } catch (ScriptException e) { if (e.getCause() instanceof BpmnError) { throw (BpmnError) e.getCause(); } String activityIdMessage = getActivityIdExceptionMessage(variableScope); throw new ScriptEvaluationException("Unable to evaluate script" + activityIdMessage +": " + e.getMessage(), e); } }