gnu.mapping
Class WrappedException
RuntimeException
gnu.mapping.WrappedException
public class WrappedException
extends RuntimeException
Encapsulate some Exception inside a RuntimeException.
Inspired by org.xml.sax.SAXException written by David Megginson.
Throwable | getException() - Return the embedded exception, if any.
|
String | toString() - Convert this exception to a string.
|
static RuntimeException | wrapIfNeeded(Throwable ex) - Coerce argument to a RuntimeException.
|
WrappedException
public WrappedException()
Create a new WrappedException.
WrappedException
public WrappedException(String message)
Create a new WrappedException.
message
- The error or warning message.
WrappedException
public WrappedException(String message,
Throwable e)
Create a new WrappedException from an existing exception.
The existing exception will be embedded in the new
one, but the new exception will have its own message.
message
- The detail message.e
- The exception to be wrapped in a WrappedException.
WrappedException
public WrappedException(Throwable e)
Create a new WrappedException wrapping an existing exception.
The existing exception will be embedded in the new
one, and its message will become the default message for
the WrappedException.
e
- The exception to be wrapped in a WrappedException.
getException
public Throwable getException()
Return the embedded exception, if any.
- The embedded exception, or null if there is none.
toString
public String toString()
Convert this exception to a string.
- A string version of this exception.
wrapIfNeeded
public static RuntimeException wrapIfNeeded(Throwable ex)
Coerce argument to a RuntimeException.