public class BundledException extends Exception implements ThrowableList
ThrowableList listExc = null
for (Thing thing : things) {
try {
} catch(AnException exc) {
// or use a specific subclass of BundledException
listExc = new BundledException(exc, listExc)
}
if(listExc != null) {
throw listExc.current() ;
}
Beware: do not confuse this with a "cause" (such as in getCause()).
The interface ThrowableList may help create list of throwables that do not necessarily extends BundledException. (this could have been implemented through multiple decorators ...)
| Constructor and Description |
|---|
BundledException(String s,
ThrowableList previousThrowable) |
BundledException(String s,
Throwable throwable,
ThrowableList previousThrowable) |
BundledException(ThrowableList previousThrowable) |
BundledException(Throwable throwable,
ThrowableList previousThrowable) |
| Modifier and Type | Method and Description |
|---|---|
Throwable |
current() |
Throwable |
previous() |
void |
setPreviousThrowable(ThrowableList previousThrowable) |
String |
toString() |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTracepublic BundledException(ThrowableList previousThrowable)
public BundledException(String s, ThrowableList previousThrowable)
public BundledException(String s, Throwable throwable, ThrowableList previousThrowable)
public BundledException(Throwable throwable, ThrowableList previousThrowable)
public Throwable previous()
previous in interface ThrowableListpublic Throwable current()
current in interface ThrowableListpublic void setPreviousThrowable(ThrowableList previousThrowable)
Copyright © 2020 LSST. All rights reserved.