mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
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:
@@ -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.
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user