public class IonException
extends java.lang.RuntimeException
IOException
) are not
propagated directly but are instead wrapped in one or more
IonException
s.
This library does not promise that such an "external cause" will be the
direct cause
of the thrown exception: there
there may be a chain of multiple IonException
before getting to the
external cause. Here's an example of how to deal with this in a situation
where the caller wants to propagate IOException
s:
try { // Call some API } catch (IonException e) { IOException io = e.causeOfType(IOException.class); if (io != null) throw io; throw e; }
Constructor and Description |
---|
IonException() |
IonException(java.lang.String message) |
IonException(java.lang.String message,
java.lang.Throwable cause) |
IonException(java.lang.Throwable cause)
Constructs a new exception with the given cause, copying the message
from the cause into this instance.
|
Modifier and Type | Method and Description |
---|---|
<T extends java.lang.Throwable> |
causeOfType(java.lang.Class<T> type)
Finds the first exception in the
Throwable.getCause() chain that is
an instance of the given type. |
public IonException()
public IonException(java.lang.String message)
public IonException(java.lang.String message, java.lang.Throwable cause)
public IonException(java.lang.Throwable cause)
cause
- the root cause of the exception; must not be null.