EvalException (Java SE 15 & JDK 15) (original) (raw)

All Implemented Interfaces:

[Serializable](../../../java.base/java/io/Serializable.html "interface in java.io")


public class EvalException extends JShellException

Wraps an throwable thrown in the executing client. An instance of EvalException can be returned in theSnippetEvent.exception() query. The name of the throwable thrown is available fromgetExceptionClassName(). Message and stack can be queried by methods on Exception.

Note that in stack trace frames representing JShell Snippets,StackTraceElement.getFileName() will return "#" followed by the Snippet id and for snippets without a method name (for example an expression) StackTraceElement.getMethodName() will be the empty string.

Since:

9

See Also:

Serialized Form

Modifier and Type Method Description
JShellException getCause() Returns the wrapped cause of the throwable in the executing client represented by this EvalException or null if the cause is nonexistent or unknown.
String getExceptionClassName() Returns the name of the Throwable subclass which was thrown in the executing client.

Methods declared in class java.lang.Throwable

[addSuppressed](../../../java.base/java/lang/Throwable.html#addSuppressed%28java.lang.Throwable%29), [fillInStackTrace](../../../java.base/java/lang/Throwable.html#fillInStackTrace%28%29), [getLocalizedMessage](../../../java.base/java/lang/Throwable.html#getLocalizedMessage%28%29), [getMessage](../../../java.base/java/lang/Throwable.html#getMessage%28%29), [getStackTrace](../../../java.base/java/lang/Throwable.html#getStackTrace%28%29), [getSuppressed](../../../java.base/java/lang/Throwable.html#getSuppressed%28%29), [initCause](../../../java.base/java/lang/Throwable.html#initCause%28java.lang.Throwable%29), [printStackTrace](../../../java.base/java/lang/Throwable.html#printStackTrace%28%29), [printStackTrace](../../../java.base/java/lang/Throwable.html#printStackTrace%28java.io.PrintStream%29), [printStackTrace](../../../java.base/java/lang/Throwable.html#printStackTrace%28java.io.PrintWriter%29), [setStackTrace](../../../java.base/java/lang/Throwable.html#setStackTrace%28java.lang.StackTraceElement%5B%5D%29), [toString](../../../java.base/java/lang/Throwable.html#toString%28%29)