polyglot stack
trace. Methods like printStackTrace() are implemented such that host and guest language
stack traces are printed nicely.
A polyglot exception may have the following properties:
Guest Exception: Is true if the exception was raised
in guest language code.
Host Exception: Is true if this exception was raised
in host runtime code. This may happen if the polyglot runtime host runtime methods that throw an
exception. The original host exception can be accessed using asHostException().
Cancelled: Is true if the execution got cancelled. The
execution may be cancelled when closing a context, by a guest language
intrinsic or by a tool, like the debugger.
Exit: Is true if the execution exited. The guest language
triggers exit events if the guest language code request to exit the VM. The exit status can be
accessed using getExitStatus().
Syntax Error: Is true if the error represents a syntax
error. For syntax errors a location may be available.
Incomplete Source: Is true if this returns a
syntax error that indicates that the source is incomplete.
Resource exhausted: Is true if a resource limit
e.g. the maximum memory was exhausted.
Internal Error: Is true if an internal implementation
error occurred in the polyglot runtime, the guest language or an instrument. It is not
recommended to show such errors to the user in production. Please consider filing issues for
internal implementation errors.
Context, Value
| Modifier and Type | Class and Description |
|---|---|
| public class | PolyglotException.
Represents a polyglot stack frame originating from a guest language or the host language Java. |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final AbstractPolyglotImpl. | |
| pack-priv final Object |
| Access | Constructor and Description |
|---|---|
| pack-priv | PolyglotException(String message, AbstractPolyglotImpl.
|
| Modifier and Type | Method and Description |
|---|---|
| public Throwable | |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Indicates whether some other object is "equal to" this one. |
| public Throwable | fillInStackTrace()
Overrides java. Unsupported, |
| public int | |
| public Value | |
| public String | getMessage()
Overrides java. Gets a user readable message for the polyglot exception. |
| public Iterable | getPolyglotStackTrace()
Provides programmatic access to the polyglot stack trace information printed by
|
| public SourceSection | getSourceLocation()
Gets a guest language source location of this error or |
| public StackTraceElement[] | getStackTrace()
Overrides java. Gets stack trace elements for Java and guest languages. |
| public int | |
| public boolean | |
| public boolean | isExit()
Returns |
| public boolean | |
| public boolean | |
| public boolean | isIncompleteSource()
Returns |
| public boolean | |
| public boolean | isInterrupted()
Returns |
| public boolean | isResourceExhausted()
Returns |
| public boolean | |
| public void | printStackTrace()
Overrides java. Prints host and guest language stack frames to the standard |
| public void | printStackTrace(PrintStream
PrintStream to use for outputOverrides java. Prints host and guest language stack frames to specified print stream. |
| public void | printStackTrace(PrintWriter
PrintWriter to use for outputOverrides java. Prints host and guest language stack frames to specified print writer. |
| public void | setStackTrace(StackTraceElement[]
the stack trace elements to be associated with
this stackTrace)Throwable. The specified array is copied by this
call; changes in the specified array after the method invocation
returns will have no effect on this Throwable's stack
trace.Overrides java. Unsupported, |
| private void | writeObject(ObjectOutputStream
the outputStream)ObjectOutputStream to which data is writtenHides java. Write a |
| dispatch | back to summary |
|---|---|
| pack-priv final AbstractPolyglotImpl. | |
| impl | back to summary |
|---|---|
| pack-priv final Object impl | |
| PolyglotException | back to summary |
|---|---|
| pack-priv PolyglotException(String message, AbstractPolyglotImpl. | |
| asHostException | back to summary |
|---|---|
| public Throwable asHostException() Returns the original Java host exception that caused this exception. The original host
exception contains a stack trace that is hardly interpretable by users as it contains details
of the language implementation. The polyglot exception provides information for user-friendly
error reporting with the
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| fillInStackTrace | back to summary |
|---|---|
| public Throwable fillInStackTrace() Overrides java. Unsupported,
| |
| getExitStatus | back to summary |
|---|---|
| public int getExitStatus() Returns the exit status if this exception indicates that the application was
| |
| getGuestObject | back to summary |
|---|---|
| public Value getGuestObject() Returns an additional guest language object. Returns
| |
| getMessage | back to summary |
|---|---|
| public String getMessage() Overrides java. Gets a user readable message for the polyglot exception. In case the exception is
| |
| getPolyglotStackTrace | back to summary |
|---|---|
| public Iterable Provides programmatic access to the polyglot stack trace information printed by
| |
| getSourceLocation | back to summary |
|---|---|
| public SourceSection getSourceLocation() Gets a guest language source location of this error or
| |
| getStackTrace | back to summary |
|---|---|
| public StackTraceElement[] getStackTrace() Overrides java. Gets stack trace elements for Java and guest languages. For polyglot exceptions it
recommended to use
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isCancelled | back to summary |
|---|---|
| public boolean isCancelled() Returns
| |
| isExit | back to summary |
|---|---|
| public boolean isExit() Returns
| |
| isGuestException | back to summary |
|---|---|
| public boolean isGuestException() Returns
| |
| isHostException | back to summary |
|---|---|
| public boolean isHostException() Returns
| |
| isIncompleteSource | back to summary |
|---|---|
| public boolean isIncompleteSource() Returns
function incompleteFunction(arg) {
A shell might react to this exception and prompt for additional source code, if this method
returns true.
| |
| isInternalError | back to summary |
|---|---|
| public boolean isInternalError() Returns
| |
| isInterrupted | back to summary |
|---|---|
| public boolean isInterrupted() Returns
| |
| isResourceExhausted | back to summary |
|---|---|
| public boolean isResourceExhausted() Returns
Resource limit exceptions may be originating from the
| |
| isSyntaxError | back to summary |
|---|---|
| public boolean isSyntaxError() Returns
| |
| printStackTrace | back to summary |
|---|---|
| public void printStackTrace() Overrides java. Prints host and guest language stack frames to the standard
| |
| printStackTrace | back to summary |
|---|---|
| public void printStackTrace(PrintStream s) Overrides java. Prints host and guest language stack frames to specified print stream.
| |
| printStackTrace | back to summary |
|---|---|
| public void printStackTrace(PrintWriter s) Overrides java. Prints host and guest language stack frames to specified print writer.
| |
| setStackTrace | back to summary |
|---|---|
| public void setStackTrace(StackTraceElement[] stackTrace) Overrides java. Unsupported,
| |
| writeObject | back to summary |
|---|---|
| private void writeObject(ObjectOutputStream outputStream) throws IOException Hides java. Doc from java. Write a
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final AbstractPolyglotImpl. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Language | |
| public String | |
| public SourceSection | getSourceLocation()
Returns the source location of the stack frame or |
| public boolean | |
| public boolean | |
| public StackTraceElement | |
| public String |
| impl | back to summary |
|---|---|
| pack-priv final AbstractPolyglotImpl. | |
| StackFrame | back to summary |
|---|---|
| pack-priv StackFrame(AbstractPolyglotImpl. | |
| getLanguage | back to summary |
|---|---|
| public Language getLanguage() Returns the language of this stack frame. In case of the host language a synthetic Java language object is returned.
| |
| getRootName | back to summary |
|---|---|
| public String getRootName() Returns the root name of this stack frame. In case of the host language the Java method name is returned. In guest languages it returns a useful identifier for code. For example, in JavaScript this can be the function name.
| |
| getSourceLocation | back to summary |
|---|---|
| public SourceSection getSourceLocation() Returns the source location of the stack frame or
| |
| isGuestFrame | back to summary |
|---|---|
| public boolean isGuestFrame() Returns true if the stack frame originates from the guest language.
| |
| isHostFrame | back to summary |
|---|---|
| public boolean isHostFrame() Returns true if the stack frame originates from the host language. Host frames do not
provide a
| |
| toHostFrame | back to summary |
|---|---|
| public StackTraceElement toHostFrame() Returns a Java stack trace element representation of the polyglot stack trace element. This is supported for host stack frames as well as guest language stack frames. A conversion to the host frame format can be useful for interoperability.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a string representation of this stack frame. The format is inspired by the Java stack frame format.
| |