org.lsst.ccs.utilities.exc
Class BundledException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.lsst.ccs.utilities.exc.BundledException
- All Implemented Interfaces:
- Serializable, ThrowableList
public class BundledException
- extends Exception
- implements ThrowableList
This is to create a Bundle of linked Exception : a code may not stop at the first Exception it catches
but store the Exception in reverse order and then , when finished, throw a Set of Exception.
Typical code could look like this:
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 ...)
- Author:
- bamade
- See Also:
- Serialized Form
BundledException
public BundledException(ThrowableList previousThrowable)
BundledException
public BundledException(String s,
ThrowableList previousThrowable)
BundledException
public BundledException(String s,
Throwable throwable,
ThrowableList previousThrowable)
BundledException
public BundledException(Throwable throwable,
ThrowableList previousThrowable)
previous
public Throwable previous()
- Specified by:
previous in interface ThrowableList
current
public Throwable current()
- Specified by:
current in interface ThrowableList
toString
public String toString()
- Overrides:
toString in class Throwable
Copyright © 2012 LSST. All Rights Reserved.