Throwable cause = ex.getCause(); exception = cause != null ? cause : ex; } catch (RuntimeException ex) {
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); } }
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); } }
@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); } } }
@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); } } }
try { engine.eval("throw new java.lang.IllegalArgumentException( 'no cookie!' )" ); } catch (ScriptException e) { Throwable cause = e.getCause(); if ( cause != null && cause instanceof IllegalArgumentException ) { // ...react explicitly } else { // ...react generically }
@Override protected void unWrapAndThrowWfsException(ScriptException e) throws ScriptException { if (e.getCause() instanceof PyException) { PyException pye = (PyException) e.getCause(); if (pye.value != null) { Object wfse = pye.value.__tojava__(Exception.class); if (wfse instanceof WFSException) { throw (WFSException) wfse; } } } throw e; }
/** * Adapt a script exception. * * @param scriptCause the script exception wrapper. */ public ScriptRepositoryException(final ScriptException scriptCause) { super(scriptCause.getMessage(), scriptCause.getCause()); } }
public synchronized String compile(String filename, String sourceName, String source, Map<String, Object> options) { bindings.put("__filename", filename); bindings.put("__sourcename", sourceName); bindings.put("__source", source); options.forEach(bindings::put); try { return compiledScript.eval(bindings).toString(); } catch (ScriptException e) { String message = cleanMessage(filename, e.getCause().getMessage()); throw new CompilerException(message); } }
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); }
private void handleScriptRuntimeException(final ScriptException e, PrintStream outStream, IFreeplaneScriptErrorHandler errorHandler) { outStream.print("message: " + e.getMessage()); int lineNumber = e.getLineNumber(); outStream.print("Line number: " + lineNumber); errorHandler.gotoLine(lineNumber); throw new ExecuteScriptException(e.getMessage() + " at line " + lineNumber, // The ScriptException should have a cause. Use // that, it is what we want to know. (e.getCause() == null) ? e : e.getCause()); }
protected void runTest(String script, String testName) { try { ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName("jruby"); engine.eval("require '" + script + "'"); engine.eval(testName + "()"); } catch (ScriptException e) { throw new AssertionError(e.getCause()); } } }
private Integer columnNumber(final ScriptException se) { if (se.getColumnNumber() >= 0) return se.getColumnNumber(); return callMethod(se.getCause(), "columnNumber", Integer.class); }
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); } }
private Integer lineNumber(final ScriptException se) { if (se.getLineNumber() >= 0) return se.getLineNumber(); return callMethod(se.getCause(), "lineNumber", Integer.class); }
public Message invoke(Message msg) { try { Object resp = doInvoke((Object[])msg.getBody(), msg.getOperation()); msg.setBody(resp); } catch (ScriptException e) { msg.setFaultBody(e.getCause()); } return msg; }
private static ResourceProblemException doHandleException( final ScriptException e ) { final ResourceProblemException.Builder builder = ResourceProblemException.newBuilder(); builder.cause( e.getCause() ); builder.lineNumber( e.getLineNumber() ); builder.resource( toResourceKey( e.getFileName() ) ); return builder.build(); }
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(); }