Print stack trace of exception causes in verbose mode

This commit is contained in:
AsamK 2021-09-08 20:38:24 +02:00
parent e3c37a0239
commit 2044a7d7a5
32 changed files with 66 additions and 60 deletions

View file

@ -40,7 +40,8 @@ public class Main {
installSecurityProviderWorkaround();
// Configuring the logger needs to happen before any logger is initialized
configureLogging(isVerbose(args));
final var isVerbose = isVerbose(args);
configureLogging(isVerbose);
var parser = App.buildArgumentParser();
@ -51,6 +52,9 @@ public class Main {
new App(ns).init();
} catch (CommandException e) {
System.err.println(e.getMessage());
if (isVerbose && e.getCause() != null) {
e.getCause().printStackTrace();
}
status = getStatusForError(e);
}
System.exit(status);