Print exception message to the console when stack trace is disabled

Make sure something is always printed to the console when sketch crashes with exception. Message in the status bar might disappear after moving the cursor.
This commit is contained in:
Jakub Valtar
2018-04-24 11:35:14 +02:00
parent d29366d34b
commit 6240843e95
2 changed files with 16 additions and 0 deletions
@@ -130,6 +130,11 @@ public class SketchException extends Exception {
}
public boolean isStackTraceEnabled() {
return showStackTrace;
}
/**
* Nix the java.lang crap out of an exception message
* because it scares the children.
+11
View File
@@ -2900,6 +2900,17 @@ public abstract class Editor extends JFrame implements RunnerListener {
if (e instanceof SketchException) {
SketchException re = (SketchException) e;
// Make sure something is printed into the console
// Status bar is volatile
if (!re.isStackTraceEnabled()) {
System.err.println(re.getMessage());
}
// Move the cursor to the line before updating the status bar, otherwise
// status message might get hidden by a potential message caused by moving
// the cursor to a line with warning in it
if (re.hasCodeIndex()) {
sketch.setCurrentCode(re.getCodeIndex());
}