public interface TruffleException
TruffleException are
considered internal errors.
TruffleException is most efficient if the cause is left
uninitialized. Implementations of TruffleException also should not prevent initialization
of the exception cause, e.g., by overriding Throwable.initCause(Throwable).
In order to be efficient, a TruffleException should override
Throwable.fillInStackTrace() without the synchronized modifier, so that it
returns this:
@SuppressWarnings("sync-override")
@Override
public final Throwable fillInStackTrace() {
return this;
}
TruffleStackTrace to access the stack trace of an exception.| Modifier and Type | Method and Description |
|---|---|
default Object |
getExceptionObject()
Returns an additional guest language object.
|
default int |
getExitStatus()
Returns the exit status if this exception indicates that the application was
exited. |
Node |
getLocation()
Returns a node indicating the location where this exception occurred in the AST.
|
default SourceSection |
getSourceLocation()
Returns a location where this exception occurred in the AST.
|
default int |
getStackTraceElementLimit()
Returns the number of guest language frames that should be collected for this exception.
|
default boolean |
isCancelled()
Returns
true if this exception indicates that guest language application was
cancelled during its execution. |
default boolean |
isExit()
Returns
true if the exception indicates that the application was exited within
the guest language program. |
default boolean |
isIncompleteSource()
Returns
true if this exception indicates a syntax error that is indicating that
the syntax is incomplete. |
default boolean |
isInternalError()
Returns
true if this exception indicates an internal error. |
default boolean |
isSyntaxError()
Returns
true if this exception indicates a parser or syntax error. |
Node getLocation()
null to indicate that the location is not available.default Object getExceptionObject()
null to indicate that no object is available for this exception.default boolean isSyntaxError()
true if this exception indicates a parser or syntax error. Syntax errors
typically occur while
parsing
of guest language source code.default boolean isIncompleteSource()
true if this exception indicates a syntax error that is indicating that
the syntax is incomplete. This allows guest language programmers to find out if more code is
expected from a given source. For example an incomplete JavaScript program could look like
this:
function incompleteFunction(arg) {
A shell might react to this exception and prompt for additional source code, if this method
returns true.default boolean isInternalError()
true if this exception indicates an internal error. Note that all
exceptions thrown in a guest language implementation that are not implementing
TruffleException are considered internal.default boolean isCancelled()
true if this exception indicates that guest language application was
cancelled during its execution.default boolean isExit()
true if the exception indicates that the application was exited within
the guest language program. If TruffleException.isExit() returns true also
TruffleException.getExitStatus() should be implemented.TruffleException.getExitStatus()default int getExitStatus()
exited. The exit status is intended to be passed to System.exit(int).TruffleException.isExit()default int getStackTraceElementLimit()
internal internal root nodes are not counted when the stack
trace limit is computed.default SourceSection getSourceLocation()
null to indicate that the location is not available.SourceSection or null