allow --show-stacktraces on bootstrap phase

This commit is contained in:
Jonathan Shook
2021-07-22 18:49:55 -05:00
parent ffe7c9c530
commit f244c0f225
2 changed files with 13 additions and 5 deletions

View File

@@ -42,6 +42,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Arrays; import java.util.Arrays;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.locks.LockSupport; import java.util.concurrent.locks.LockSupport;
@@ -68,7 +69,14 @@ public class NBCLI {
NBCLI cli = new NBCLI("eb"); NBCLI cli = new NBCLI("eb");
cli.run(args); cli.run(args);
} catch (Exception e) { } catch (Exception e) {
String error = ScenarioErrorHandler.handle(e, false); boolean showStackTraces = false;
for (String arg : args) {
if (arg.toLowerCase(Locale.ROOT).equals("--show-stacktraces")) {
showStackTraces=true;
}
}
String error = ScenarioErrorHandler.handle(e, showStackTraces);
// Commented for now, as the above handler should do everything needed. // Commented for now, as the above handler should do everything needed.
if (error != null) { if (error != null) {
System.err.println("Scenario stopped due to error. See logs for details."); System.err.println("Scenario stopped due to error. See logs for details.");

View File

@@ -357,6 +357,10 @@ public class NBCLIOptions {
arglist.removeFirst(); arglist.removeFirst();
consoleLoggingPattern = readWordOrThrow(arglist, "logging pattern"); consoleLoggingPattern = readWordOrThrow(arglist, "logging pattern");
break; break;
case SHOW_STACKTRACES:
arglist.removeFirst();
showStackTraces = true;
break;
default: default:
nonincludes.addLast(arglist.removeFirst()); nonincludes.addLast(arglist.removeFirst());
} }
@@ -440,10 +444,6 @@ public class NBCLIOptions {
arglist.removeFirst(); arglist.removeFirst();
showScript = true; showScript = true;
break; break;
case SHOW_STACKTRACES:
arglist.removeFirst();
showStackTraces = true;
break;
case LIST_METRICS: case LIST_METRICS:
arglist.removeFirst(); arglist.removeFirst();
arglist.addFirst("start"); arglist.addFirst("start");