public class CatalogException extends RuntimeException
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 ... } }
Modifier and Type | Field and Description |
---|---|
private CatalogException |
m_next_exception
chains the next exception into line.
|
Constructor and Description |
---|
CatalogException() |
CatalogException(String s)
Constructs a
CatalogException with the
specified detailed message. |
CatalogException(String s,
Throwable cause)
Constructs a
CatalogException with the
specified detailed message and a cause. |
CatalogException(Throwable cause)
Constructs a
CatalogException with the
specified just a cause. |
Modifier and Type | Method and Description |
---|---|
CatalogException |
getNextException()
Retrieves the exception chained to this
CatalogException object. |
void |
setNextException(CatalogException ex)
Adds an
CatalogException |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
private CatalogException m_next_exception
public CatalogException()
public CatalogException(String s)
CatalogException
with the
specified detailed message.s
- is the detailled message.public CatalogException(String s, Throwable cause)
CatalogException
with the
specified detailed message and a cause.s
- is the detailled message.cause
- is the cause (which is saved for later retrieval by the
Throwable.getCause()
method). A null
value is permitted, and indicates that the cause is nonexistent or
unknown.public CatalogException(Throwable cause)
CatalogException
with the
specified just a cause.cause
- is the cause (which is saved for later retrieval by the
Throwable.getCause()
method). A null
value is permitted, and indicates that the cause is nonexistent or
unknown.public CatalogException getNextException()
CatalogException
object.CatalogException
object in the chain;
null
if there are none.setNextException( CatalogException )
public void setNextException(CatalogException ex)
CatalogException object to the end of
the chain.
ex
- the new exception that will be added to the end of the
CatalogException
chain.getNextException()
Copyright © 2011 The University of Southern California. All Rights Reserved.