java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.aoapps.lang.exception.WrappedException
- All Implemented Interfaces:
ExtraInfo
,Serializable
A wrapped exception may be used to rethrow checked exceptions in a context
where they are otherwise not allowed.
This could be accomplished by
rethrowing with RuntimeException
directly, but having this distinct
class provides more meaning as well as the ability to catch wrapped
exceptions while letting all other runtime exceptions go through directly.
Catching WrappedException
may be used to unwrap expected throwable types.
- Author:
- AO Industries, Inc.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Please provide cause.WrappedException
(IOException cause) Deprecated.Please useUncheckedIOException
.WrappedException
(IOException cause, Object... extraInfo) Deprecated.Please useUncheckedIOException
.WrappedException
(String message) Deprecated.Please provide cause.WrappedException
(String message, IOException cause) Deprecated.Please useUncheckedIOException
.WrappedException
(String message, IOException cause, Object... extraInfo) Deprecated.Please useUncheckedIOException
.WrappedException
(String message, Throwable cause) Uses extra info of the original cause when it is anExtraInfo
.WrappedException
(String message, Throwable cause, Object... extraInfo) WrappedException
(Throwable cause) Uses extra info of the original cause when it is anExtraInfo
.WrappedException
(Throwable cause, Object... extraInfo) -
Method Summary
Modifier and TypeMethodDescriptionstatic <V> V
Invokes the given callable, wrapping any checked exceptions.static <V> V
Invokes the given callable, wrapping any checked exceptions.static <V> V
Invokes the given callable, wrapping any checked exceptions.static <V> V
Invokes the given callable, wrapping any checked exceptions.static <V> V
Invokes the given callable, wrapping any checked exceptions.static <V> V
Invokes the given callable, wrapping any checked exceptions.static <V> V
Invokes the given callable, wrapping any checked exceptions.static <V> V
Invokes the given callable, wrapping any checked exceptions.Object[]
Gets the optional extra info associated with an exception.static void
Invokes the given runnable, wrapping any checked exceptions.static void
Invokes the given runnable, wrapping any checked exceptions.static void
Invokes the given runnable, wrapping any checked exceptions.static void
Invokes the given runnable, wrapping any checked exceptions.static <V> V
wrapChecked
(Callable<V> callable) Deprecated.Please usecall(java.util.concurrent.Callable)
static <V> V
wrapChecked
(Callable<V> callable, Object... extraInfo) Deprecated.static <V> V
wrapChecked
(Callable<V> callable, String message) Deprecated.static <V> V
wrapChecked
(Callable<V> callable, String message, Object... extraInfo) Deprecated.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
WrappedException
Deprecated.Please provide cause. -
WrappedException
Deprecated.Please provide cause. -
WrappedException
Uses extra info of the original cause when it is anExtraInfo
. -
WrappedException
Deprecated.Please useUncheckedIOException
. -
WrappedException
- Parameters:
extraInfo
- No defensive copy
-
WrappedException
Deprecated.Please useUncheckedIOException
. -
WrappedException
Uses extra info of the original cause when it is anExtraInfo
. -
WrappedException
Deprecated.Please useUncheckedIOException
. -
WrappedException
- Parameters:
extraInfo
- No defensive copy
-
WrappedException
Deprecated.Please useUncheckedIOException
.
-
-
Method Details
-
call
Invokes the given callable, wrapping any checked exceptions. -
wrapChecked
Deprecated.Please usecall(java.util.concurrent.Callable)
Invokes the given callable, wrapping any checked exceptions. -
call
Invokes the given callable, wrapping any checked exceptions. -
wrapChecked
Deprecated.Invokes the given callable, wrapping any checked exceptions. -
call
Invokes the given callable, wrapping any checked exceptions. -
wrapChecked
Deprecated.Invokes the given callable, wrapping any checked exceptions. -
call
Invokes the given callable, wrapping any checked exceptions. -
wrapChecked
@Deprecated public static <V> V wrapChecked(Callable<V> callable, String message, Object... extraInfo) Deprecated.Invokes the given callable, wrapping any checked exceptions. -
callE
Invokes the given callable, wrapping any checked exceptions. -
callE
Invokes the given callable, wrapping any checked exceptions. -
callE
Invokes the given callable, wrapping any checked exceptions. -
callE
Invokes the given callable, wrapping any checked exceptions. -
runE
Invokes the given runnable, wrapping any checked exceptions. -
runE
Invokes the given runnable, wrapping any checked exceptions. -
runE
Invokes the given runnable, wrapping any checked exceptions. -
runE
Invokes the given runnable, wrapping any checked exceptions. -
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
-