Skip to content

Commit 8a85bb2

Browse files
lukasstadlerfangerer
authored andcommitted
always show non-Python guest language exceptions
1 parent a48e759 commit 8a85bb2

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/control/TopLevelExceptionHandler.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
import com.oracle.graal.python.runtime.PythonContext;
7272
import com.oracle.graal.python.runtime.PythonCore;
7373
import com.oracle.graal.python.runtime.PythonOptions;
74+
import com.oracle.graal.python.runtime.exception.ExceptionUtils;
7475
import com.oracle.graal.python.runtime.exception.PException;
7576
import com.oracle.graal.python.runtime.exception.PythonExitException;
7677
import com.oracle.graal.python.runtime.object.PythonObjectFactory;
@@ -136,10 +137,12 @@ public Object execute(VirtualFrame frame) {
136137
}
137138
return null;
138139
} catch (Exception | StackOverflowError e) {
139-
if (PythonOptions.getOption(context.get(), PythonOptions.WithJavaStacktrace)) {
140-
boolean exitException = e instanceof TruffleException && ((TruffleException) e).isExit();
141-
if (!exitException) {
140+
boolean exitException = e instanceof TruffleException && ((TruffleException) e).isExit();
141+
if (!exitException) {
142+
if (PythonOptions.getOption(context.get(), PythonOptions.WithJavaStacktrace)) {
142143
printStackTrace(e);
144+
} else {
145+
ExceptionUtils.printPythonLikeStackTrace(e);
143146
}
144147
}
145148
throw e;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/exception/ExceptionUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private ExceptionUtils() {
5555
}
5656

5757
@TruffleBoundary
58-
public static void printPythonLikeStackTrace(PException e) {
58+
public static void printPythonLikeStackTrace(Throwable e) {
5959
List<TruffleStackTraceElement> stackTrace = TruffleStackTrace.getStackTrace(e);
6060
ArrayList<String> stack = new ArrayList<>();
6161
for (TruffleStackTraceElement frame : stackTrace) {

0 commit comments

Comments
 (0)