code: private void handleScriptException(ScriptWrapper script, Writer writer, Exception exception) {
  		Exception cause = exception;
  		if (cause instanceof ScriptException && cause.getCause() instanceof Exception) {
  			// Dereference one level
  			cause = (Exception) cause.getCause();
  		}
  		try {
  			writer.append(cause.toString());
  		} catch (IOException ignore) {
  			logger.error(cause.getMessage(), cause);
  		}
  		this.setError(script, cause);
  		this.setEnabled(script, false);
  	}
docs: Handles exceptions thrown by scripts.
  <p>
  The given {@code exception} (if of type {@code ScriptException} the cause will be used instead) will be written to the
  given {@code writer} and the given {@code script} will be disabled and flagged that has an error.
  
  @param script the script that resulted in an exception, must not be {@code null}
  @param writer the writer associated with the script, must not be {@code null}
  @param exception the exception thrown , must not be {@code null}
  @see #setError(ScriptWrapper, Exception)
  @see #setEnabled(ScriptWrapper, boolean)
  @see ScriptException