mirror of
https://github.com/mitb-archive/filebot
synced 2024-08-13 17:03:45 -04:00
* allow die(Throwable) usage
This commit is contained in:
parent
b2150b3392
commit
fb884c017a
@ -112,7 +112,7 @@ public class ArgumentProcessor {
|
|||||||
CLILogger.finest("Done ヾ(@⌒ー⌒@)ノ");
|
CLILogger.finest("Done ヾ(@⌒ー⌒@)ノ");
|
||||||
return 0;
|
return 0;
|
||||||
} catch (ScriptDeath e) {
|
} catch (ScriptDeath e) {
|
||||||
CLILogger.log(Level.WARNING, e.getMessage());
|
CLILogger.log(Level.WARNING, e.getMessage(), e.getCause());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
CLILogger.log(Level.SEVERE, String.format("%s: %s", getRootCause(e).getClass().getSimpleName(), getRootCauseMessage(e)), getRootCause(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);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScriptDeath(String message, Throwable cause) {
|
public ScriptDeath(Throwable cause) {
|
||||||
super(message, cause);
|
super(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -126,8 +126,11 @@ public abstract class ScriptShellBaseClass extends Script {
|
|||||||
// StackTraceUtils.deepSanitize(t).printStackTrace();
|
// StackTraceUtils.deepSanitize(t).printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void die(String message) throws Throwable {
|
public void die(Object cause) throws Throwable {
|
||||||
throw new ScriptDeath(message);
|
if (cause instanceof Throwable) {
|
||||||
|
throw new ScriptDeath((Throwable) cause);
|
||||||
|
}
|
||||||
|
throw new ScriptDeath(cause.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// define global variable: _args
|
// define global variable: _args
|
||||||
@ -473,7 +476,7 @@ public abstract class ScriptShellBaseClass extends Script {
|
|||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RenameAction getRenameFunction(final Object obj) {
|
public RenameAction getRenameFunction(final Object obj) {
|
||||||
if (obj instanceof RenameAction) {
|
if (obj instanceof RenameAction) {
|
||||||
return (RenameAction) obj;
|
return (RenameAction) obj;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user