Skip to content

Commit

Permalink
Handle groovy's uncaught exceptions and throwables accordingly (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rongmario authored Dec 16, 2023
1 parent 15b6b48 commit 2cd6506
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.cleanroommc.groovyscript.sandbox.transformer.GroovyScriptCompiler;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyRuntimeException;
import groovy.util.GroovyScriptEngine;
import groovy.util.ResourceException;
import groovy.util.ScriptException;
Expand Down Expand Up @@ -89,11 +90,11 @@ public void run(LoadStage currentLoadStage) {
this.currentLoadStage = Objects.requireNonNull(currentLoadStage);
try {
super.load();
} catch (IOException | ScriptException | ResourceException e) {
GroovyLog.get().errorMC("An Exception occurred trying to run groovy!");
} catch (IOException | ScriptException | ResourceException | GroovyRuntimeException e) {
GroovyLog.get().errorMC("An exception occurred while trying to run groovy code!");
GroovyScript.LOGGER.throwing(e);
} catch (Exception e) {
GroovyLog.get().exception(e);
} catch (Throwable t) {
GroovyLog.get().exception(t);
} finally {
this.currentLoadStage = null;
}
Expand Down

0 comments on commit 2cd6506

Please sign in to comment.