wrapper.logExceptions(true);By default exception messages will be send to the
err
stream, but it is possible to control how the exceptions are logged by implementing the ScriptLogger interface and setting the logger to the wrapper by:wrapper.setScriptLogger(<the logger>);
wrapper.addExceptionListener(<the listener>);The exception listener has three methods:
ScriptRuntimeException
allows to get the StackTrace with optionally only the script stack elementsSTATE_OK
. It is the responsability of the listener to implement correctly the notified
, notifiedFirst
, aborted
, and resetState
methods to be sure that the listener return its state correctly.
char
second argument in the notified
and notifiedFirst
methods is the type of exception, which can be:scriptHelperSwing.jar
file in your ClasspathScriptWrapper<Script> wrapper = new GroovyScriptWrapper() { } ... SwingExceptionListener listener = new SwingExceptionListener(); wrapper.addExceptionListener(listener);Then the first exception encountered during the compilation or execution of the script will popup the following window:
SwingExceptionListener
handles correctly the getScriptState()
method.scriptHelperSwing.jar
file in your ClasspathCopyright 2019-2020 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence