Package io.vertigo.core.lang
Class WrappedException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.vertigo.core.lang.WrappedException
- All Implemented Interfaces:
Serializable
Exception wrapper for converting checked exceptions to unchecked.
Features:
- Preserves original stack trace
- Handles InvocationTargetException unwrapping
- Supports custom error messages
- Maintains existing RuntimeExceptions
Used to simplify exception handling while preserving error context.
- Author:
- npiedeloup
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionunwrap()Retrieves the original wrapped exception.static RuntimeExceptionWraps any exception into a RuntimeException.static RuntimeExceptionWraps any exception into a RuntimeException with custom message.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Method Details
-
wrap
Wraps any exception into a RuntimeException. Preserves original exception if already unchecked.- Parameters:
th- Original exception- Returns:
- RuntimeException wrapper
-
wrap
Wraps any exception into a RuntimeException with custom message. Preserves original exception if already unchecked.- Parameters:
th- Original exceptionmsg- Custom messageparams- Message parameters- Returns:
- RuntimeException wrapper
-
unwrap
Retrieves the original wrapped exception.- Returns:
- Original exception
-