Class to notify of failures. Exceptions are chained like the
java.sql.SQLException interface.
Here is a fragment of code to chain exceptions for later throwing:
CatalogException rce = null;
... some loop code ... {
...
if ( exception triggered ) {
if ( rce == null ) rce = new CatalogException( reason );
else rce.setNextException( new CatalogException(reason) );
...
} ... loop end ...
if ( rce != null ) throw rce;
Here is a fragment of code to unchain exceptions in the client:
try {
... operation ...
} catch ( CatalogException rce ) {
for ( ; rce != null; rce = rce.getNextException ) {
... do something with the payload ...
}
}
author: Karan Vahi author: Jens-S. Vöckler |