UndeclaredThrowableException (Java SE 19 & JDK 19) (original) (raw)

All Implemented Interfaces:

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


public class UndeclaredThrowableException extends RuntimeException

Thrown by a method invocation on a proxy instance if its invocation handler's invoke method throws a checked exception (a Throwable that is not assignable to RuntimeException or Error) that is not assignable to any of the exception types declared in thethrows clause of the method that was invoked on the proxy instance and dispatched to the invocation handler.

An UndeclaredThrowableException instance contains the undeclared checked exception that was thrown by the invocation handler, and it can be retrieved with thegetUndeclaredThrowable() method.UndeclaredThrowableException extendsRuntimeException, so it is an unchecked exception that wraps a checked exception.

Since:

1.3

See Also:

Constructors
Constructs an UndeclaredThrowableException with the specified Throwable.
Constructs an UndeclaredThrowableException with the specified Throwable and a detail message.

Returns the Throwable instance wrapped in thisUndeclaredThrowableException, which may be null.

Methods declared in class java.lang.Throwable

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