mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-11-22 15:12:06 +01:00
Add --stacktrace option
This commit is contained in:
parent
c32ef9830b
commit
fd4c22cde6
2 changed files with 10 additions and 1 deletions
|
@ -19,8 +19,13 @@ public class SOPExecutionExceptionHandler implements CommandLine.IExecutionExcep
|
||||||
// CHECKSTYLE:OFF
|
// CHECKSTYLE:OFF
|
||||||
if (ex.getMessage() != null) {
|
if (ex.getMessage() != null) {
|
||||||
commandLine.getErr().println(colorScheme.errorText(ex.getMessage()));
|
commandLine.getErr().println(colorScheme.errorText(ex.getMessage()));
|
||||||
|
} else {
|
||||||
|
commandLine.getErr().println(ex.getClass().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SopCLI.stacktrace) {
|
||||||
|
ex.printStackTrace(commandLine.getErr());
|
||||||
}
|
}
|
||||||
ex.printStackTrace(commandLine.getErr());
|
|
||||||
// CHECKSTYLE:ON
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
return exitCode;
|
return exitCode;
|
||||||
|
|
|
@ -52,6 +52,10 @@ public class SopCLI {
|
||||||
|
|
||||||
public static String EXECUTABLE_NAME = "sop";
|
public static String EXECUTABLE_NAME = "sop";
|
||||||
|
|
||||||
|
@CommandLine.Option(names = {"--stacktrace"}, description = "Print Stacktrace",
|
||||||
|
scope = CommandLine.ScopeType.INHERIT)
|
||||||
|
static boolean stacktrace;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
int exitCode = execute(args);
|
int exitCode = execute(args);
|
||||||
if (exitCode != 0) {
|
if (exitCode != 0) {
|
||||||
|
|
Loading…
Reference in a new issue