|
56 | 56 | import com.oracle.graal.python.nodes.call.CallNode; |
57 | 57 | import com.oracle.graal.python.runtime.PythonContext; |
58 | 58 | import com.oracle.truffle.api.CompilerAsserts; |
| 59 | +import com.oracle.truffle.api.CompilerDirectives; |
59 | 60 | import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; |
60 | 61 | import com.oracle.truffle.api.RootCallTarget; |
61 | 62 | import com.oracle.truffle.api.Truffle; |
|
64 | 65 | import com.oracle.truffle.api.frame.Frame; |
65 | 66 | import com.oracle.truffle.api.frame.FrameInstance; |
66 | 67 | import com.oracle.truffle.api.frame.FrameInstanceVisitor; |
| 68 | +import com.oracle.truffle.api.interop.InteropLibrary; |
| 69 | +import com.oracle.truffle.api.interop.UnsupportedMessageException; |
67 | 70 | import com.oracle.truffle.api.nodes.Node; |
68 | 71 | import com.oracle.truffle.api.nodes.RootNode; |
69 | 72 | import com.oracle.truffle.api.source.SourceSection; |
@@ -106,7 +109,16 @@ public static void printPythonLikeStackTrace(Throwable e) { |
106 | 109 | } |
107 | 110 | printStack(stack); |
108 | 111 | } |
109 | | - System.err.println(e.getMessage()); |
| 112 | + InteropLibrary lib = InteropLibrary.getUncached(); |
| 113 | + if (lib.isException(e)) { |
| 114 | + try { |
| 115 | + System.err.println(lib.getExceptionMessage(e)); |
| 116 | + } catch (UnsupportedMessageException unsupportedMessageException) { |
| 117 | + throw CompilerDirectives.shouldNotReachHere(); |
| 118 | + } |
| 119 | + } else { |
| 120 | + System.err.println(e.getMessage()); |
| 121 | + } |
110 | 122 | } |
111 | 123 |
|
112 | 124 | private static void appendStackLine(ArrayList<String> stack, Node location, RootNode rootNode, boolean evenWithoutSource) { |
|
0 commit comments