File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
src/main/java/org/scijava/script Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 4242import java .util .List ;
4343
4444import javax .script .Bindings ;
45+ import javax .script .ScriptException ;
4546
4647import org .scijava .Context ;
4748import org .scijava .Gateway ;
@@ -154,7 +155,17 @@ public boolean evaluate(final String line) {
154155 out .println (s (result ));
155156 }
156157 }
158+ catch (final ScriptException exc ) {
159+ // NB: Something went wrong interpreting the line of code.
160+ // Let's just display the error message, unless we are in debug mode.
161+ if (log .isDebug ()) exc .printStackTrace (out );
162+ else {
163+ final String msg = exc .getMessage ();
164+ out .println (msg == null ? exc .getClass ().getName () : msg );
165+ }
166+ }
157167 catch (final Throwable exc ) {
168+ // NB: Something unusual went wrong. Dump the whole exception always.
158169 exc .printStackTrace (out );
159170 }
160171 }
You can’t perform that action at this time.
0 commit comments