* allow die(Throwable) usage
This commit is contained in:
parent
b2150b3392
commit
fb884c017a
|
@ -112,7 +112,7 @@ public class ArgumentProcessor {
|
|||
CLILogger.finest("Done ヾ(@⌒ー⌒@)ノ");
|
||||
return 0;
|
||||
} catch (ScriptDeath e) {
|
||||
CLILogger.log(Level.WARNING, e.getMessage());
|
||||
CLILogger.log(Level.WARNING, e.getMessage(), e.getCause());
|
||||
} catch (Throwable e) {
|
||||
CLILogger.log(Level.SEVERE, String.format("%s: %s", getRootCause(e).getClass().getSimpleName(), getRootCauseMessage(e)), getRootCause(e));
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ public class ScriptDeath extends Throwable {
|
|||
super(message);
|
||||
}
|
||||
|
||||
public ScriptDeath(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
public ScriptDeath(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -126,8 +126,11 @@ public abstract class ScriptShellBaseClass extends Script {
|
|||
// StackTraceUtils.deepSanitize(t).printStackTrace();
|
||||
}
|
||||
|
||||
public void die(String message) throws Throwable {
|
||||
throw new ScriptDeath(message);
|
||||
public void die(Object cause) throws Throwable {
|
||||
if (cause instanceof Throwable) {
|
||||
throw new ScriptDeath((Throwable) cause);
|
||||
}
|
||||
throw new ScriptDeath(cause.toString());
|
||||
}
|
||||
|
||||
// define global variable: _args
|
||||
|
@ -473,7 +476,7 @@ public abstract class ScriptShellBaseClass extends Script {
|
|||
return options;
|
||||
}
|
||||
|
||||
private RenameAction getRenameFunction(final Object obj) {
|
||||
public RenameAction getRenameFunction(final Object obj) {
|
||||
if (obj instanceof RenameAction) {
|
||||
return (RenameAction) obj;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue