- All Implemented Interfaces:
ExtraInfo
,Serializable
A wrapped error may be used to rethrow any throwable in a context where Error
is expected. As this is not
often the case, you probably want to use WrappedException
to wrap checked exceptions.
This could be accomplished by
rethrowing with Error
directly, but having this distinct
class provides more meaning as well as the ability to catch wrapped
errors while letting all other errors go through directly.
Catching WrappedError
may be used to unwrap expected throwable types.
- Author:
- AO Industries, Inc.
- See Also:
-
Constructor Summary
ConstructorDescriptionWrappedError
(String message, Throwable cause) Uses extra info of the original cause when it is anExtraInfo
.WrappedError
(String message, Throwable cause, Object... extraInfo) WrappedError
(Throwable cause) Uses extra info of the original cause when it is anExtraInfo
.WrappedError
(Throwable cause, Object... extraInfo) -
Method Summary
Modifier and TypeMethodDescriptionObject[]
Gets the optional extra info associated with an exception.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
Method Details
-
getMessage
- Overrides:
getMessage
in classThrowable
-
getLocalizedMessage
- Overrides:
getLocalizedMessage
in classThrowable
-
getExtraInfo
Gets the optional extra info associated with an exception.- Specified by:
getExtraInfo
in interfaceExtraInfo
- Returns:
- No defensive copy
-