Merge pull request #4152 from gohai/recursion-message

Make the error message for stack overflows clearer
This commit is contained in:
Ben Fry
2016-02-13 17:07:20 -05:00

View File

@@ -749,6 +749,12 @@ public class Runner implements MessageConsumer {
// This shouldn't happen, but if it does, print the exception in case
// it's something that needs to be debugged separately.
e.printStackTrace(sketchErr);
} catch (Exception e) {
// stack overflows seem to trip in frame.location() above
// ignore this case so that the actual error gets reported to the user
if ("StackOverflowError".equals(message) == false) {
e.printStackTrace(sketchErr);
}
}
// before giving up, try to extract from the throwable object itself
// since sometimes exceptions are re-thrown from a different context
@@ -780,7 +786,11 @@ public class Runner implements MessageConsumer {
or.invokeMethod(thread, method, new ArrayList<Value>(), ObjectReference.INVOKE_SINGLE_THREADED);
} catch (Exception e) {
e.printStackTrace(sketchErr);
// stack overflows will make the exception handling above trip again
// ignore this case so that the actual error gets reported to the user
if ("StackOverflowError".equals(message) == false) {
e.printStackTrace(sketchErr);
}
}
// Give up, nothing found inside the pile of stack frames
SketchException rex = new SketchException(message);