Skip to content

Commit

Permalink
Pass the exception itself instead of ex.getMessage() to error output,…
Browse files Browse the repository at this point in the history
… to get more complete printout including exception name.
  • Loading branch information
jcferretti committed Jan 4, 2022
1 parent 1f105d3 commit c00f375
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion datagen/src/main/java/io/deephaven/datagen/DataGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public static void generateData(
try {
outputFile = new FileWriter(outputFilename);
} catch (IOException ex) {
String err = String.format("Couldn't create output file: %s\n", ex.getMessage());
String err = String.format("Couldn't create output file: %s\n", ex);
System.err.printf(err);
throw new InternalError(err);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private SelectionGenerator(
System.err.printf("File %s not found", fileName);
throw new IllegalStateException();
} catch (IOException e) {
System.err.printf("IOException while reading %s: %s", fileName, e.getMessage());
System.err.printf("IOException while reading %s: %s", fileName, e);
throw new IllegalStateException();
}

Expand Down
2 changes: 1 addition & 1 deletion datagen/src/main/java/io/deephaven/datagen/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public static ArrayList<Object> readFile(final String filename, final DataGenera
System.err.printf("File %s not found", filename);
throw new IllegalStateException();
} catch (IOException e) {
System.err.printf("IOException while reading %s: %s", filename, e.getMessage());
System.err.printf("IOException while reading %s: %s", filename, e);
throw new IllegalStateException();
}

Expand Down
22 changes: 11 additions & 11 deletions src/main/java/io/deephaven/bencher/BencherApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static void runBenchmark(
try {
changes = console.get().executeCode(statement);
} catch (Exception ex) {
System.err.printf("Execution of \"%s\" failed: %s\n", title, ex.getMessage());
System.err.printf("Execution of \"%s\" failed: %s\n", title, ex);
System.exit(1);
// keep the compiler happy.
throw new IllegalStateException();
Expand Down Expand Up @@ -231,7 +231,7 @@ static void runBenchmark(
try {
changes = console.get().executeCode(varTracker.generateCleanupPythonStatement());
} catch (Exception ex) {
System.err.printf("Execution of final clean up variables phase failed: %s\n", ex.getMessage());
System.err.printf("Execution of final clean up variables phase failed: %s\n", ex);
System.exit(1);
// keep the compiler happy.
throw new IllegalStateException();
Expand Down Expand Up @@ -374,13 +374,13 @@ private static void run(final Supplier<ConsoleSession> console, final String out
try {
benchmarks = getBenchmarks(jobFile);
} catch (FileNotFoundException ex) {
System.err.printf(me + ": Couldn't find file \"%s\": %s.\n", jobFile.getAbsolutePath(), ex.getMessage());
System.err.printf(me + ": Couldn't find file \"%s\": %s.\n", jobFile.getAbsolutePath(), ex);
System.exit(1);
} catch (IOException ex) {
System.err.printf(me + ": Couldn't read file \"%s\": %s.\n", jobFile.getAbsolutePath(), ex.getMessage());
System.err.printf(me + ": Couldn't read file \"%s\": %s.\n", jobFile.getAbsolutePath(), ex);
System.exit(1);
} catch (ParseException ex) {
System.err.printf(me + ": Couldn't parse file \"%s\": %s.\n", jobFile.getAbsolutePath(), ex.getMessage());
System.err.printf(me + ": Couldn't parse file \"%s\": %s.\n", jobFile.getAbsolutePath(), ex);
System.exit(1);
}

Expand All @@ -406,10 +406,10 @@ private static void run(final Supplier<ConsoleSession> console, final String out
try {
DataGen.generateData(outputPrefixPath, inputFileDir, generatorFilename);
} catch (IOException ex) {
System.err.printf(me + ": Couldn't read generator file \"%s\": %s\n", generatorFilename, ex.getMessage());
System.err.printf(me + ": Couldn't read generator file \"%s\": %s\n", generatorFilename, ex);
System.exit(1);
} catch (ParseException ex) {
System.err.printf(me + ": Couldn't parse generator file \"%s\": %s\n", generatorFilename, ex.getMessage());
System.err.printf(me + ": Couldn't parse generator file \"%s\": %s\n", generatorFilename, ex);
System.exit(1);
}
}
Expand All @@ -436,18 +436,18 @@ private static void run(final Supplier<ConsoleSession> console, final String out
}
} catch (IOException ex) {
if (benchFilename != null) {
System.err.printf(me + ": Couldn't read benchmark file \"%s\": %s\n", benchFilename, ex.getMessage());
System.err.printf(me + ": Couldn't read benchmark file \"%s\": %s\n", benchFilename, ex);
} else {
System.err.printf(me + ": Couldnt read benchmark: %s.\n", ex.getMessage());
System.err.printf(me + ": Couldnt read benchmark: %s.\n", ex);
}
System.exit(1);
} catch (ParseException ex) {
System.err.printf(me + ": Couldn't parse benchmark file \"%s\": %s\n",
jobFile.getAbsolutePath(), ex.getMessage());
jobFile.getAbsolutePath(), ex);
System.exit(1);
} catch (Exception ex) {
System.err.printf(me + ": Execution failed for \"%s\": %s\n",
title, ex.getMessage());
title, ex);
System.exit(1);
}

Expand Down

0 comments on commit c00f375

Please sign in to comment.