File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/exception Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 66
66
import com .oracle .truffle .api .library .ExportLibrary ;
67
67
import com .oracle .truffle .api .library .ExportMessage ;
68
68
import com .oracle .truffle .api .nodes .Node ;
69
+ import com .oracle .truffle .api .source .SourceSection ;
69
70
70
71
/**
71
72
* Serves both as a throwable carrier of the python exception object and as a represenation of the
@@ -351,5 +352,19 @@ RuntimeException throwException() {
351
352
throw getExceptionForReraise ();
352
353
}
353
354
355
+ @ ExportMessage
356
+ @ SuppressWarnings ("static-method" )
357
+ boolean hasSourceLocation () {
358
+ return getLocation () != null ;
359
+ }
360
+
361
+ @ ExportMessage (name = "getSourceLocation" )
362
+ SourceSection getExceptionSourceLocation () throws UnsupportedMessageException {
363
+ if (hasSourceLocation ()) {
364
+ return getLocation ().getEncapsulatingSourceSection ();
365
+ }
366
+ throw UnsupportedMessageException .create ();
367
+ }
368
+
354
369
// Note: remaining interop messages are forwarded to the contained PBaseException
355
370
}
You can’t perform that action at this time.
0 commit comments