public abstract class SagaException extends Exception implements Comparable<SagaException>, Iterable<SagaException>
Throwable.getMessage()
method does not quite behave as specified in the SAGA specs,
because Java already has toString()
for exactly that behavior.
So, Throwable.getMessage()
does what it always does for Java throwables.
A simple mechanism exists for storing and examining exceptions that may be thrown
by adaptors in adaptor-based Saga implementations. In such implementations, the
top-level exception (the one highest up in the Saga exception hierarchy) is not
always the most informative one, and the implementation is not always capable
of selecting the most informative exception. In these cases, the implementation
may opt to add the individual exceptions as nested exceptions to the exception
thrown. The nested exceptions can be examined using the getAllExceptions()
or getAllMessages()
methods.
In addition to the getAllExceptions()
and getAllMessages()
mechanisms,
this implementation also allows the user to iterate over the lower-level exception
list.
Modifier and Type | Field and Description |
---|---|
protected static int |
ALREADY_EXISTS |
protected static int |
AUTHENTICATION_FAILED |
protected static int |
AUTHORIZATION_FAILED |
protected static int |
BAD_PARAMETER |
protected static int |
DOES_NOT_EXIST |
protected static int |
INCORRECT_STATE |
protected static int |
INCORRECT_URL |
protected static int |
IO_EXCEPTION |
protected static int |
NO_SUCCESS |
protected static int |
NOT_IMPLEMENTED |
protected static int |
PERMISSION_DENIED |
protected static int |
TIMEOUT |
Modifier | Constructor and Description |
---|---|
protected |
SagaException(int order)
Constructs a new SAGA exception.
|
protected |
SagaException(int order,
String message)
Constructs a new SAGA exception with the specified detail message.
|
protected |
SagaException(int order,
String message,
SagaObject object)
Constructs a new SAGA exception with the specified detail message and
associated SAGA object.
|
protected |
SagaException(int order,
String message,
Throwable cause)
Constructs a new SAGA exception with the specified detail message and
cause.
|
protected |
SagaException(int order,
String detail,
Throwable cause,
SagaObject object)
Constructs a new SAGA exception with the specified detail message,
specified cause and associated SAGA object.
|
protected |
SagaException(int order,
Throwable cause)
Constructs a new SAGA exception with the specified cause.
|
protected |
SagaException(int order,
Throwable cause,
SagaObject object)
Constructs a new SAGA exception with the specified cause and
associated SAGA object.
|
Modifier and Type | Method and Description |
---|---|
void |
addNestedException(SagaException e)
Adds an exception to the list of nested exceptions.
|
int |
compareTo(SagaException o)
Gives preference to the most specific exception.
|
List<SagaException> |
getAllExceptions()
Gets the list of lower-level exceptions.
|
List<String> |
getAllMessages()
Gets the list of lower-level exception messages.
|
SagaObject |
getObject()
Returns the SAGA object associated with this exception.
|
Iterator<SagaException> |
iterator()
Returns an iterator that iterates over the nested exceptions.
|
String |
toString()
Returns a short description of this
SagaException . |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
protected static final int INCORRECT_URL
protected static final int BAD_PARAMETER
protected static final int ALREADY_EXISTS
protected static final int DOES_NOT_EXIST
protected static final int INCORRECT_STATE
protected static final int PERMISSION_DENIED
protected static final int AUTHORIZATION_FAILED
protected static final int AUTHENTICATION_FAILED
protected static final int IO_EXCEPTION
protected static final int TIMEOUT
protected static final int NO_SUCCESS
protected static final int NOT_IMPLEMENTED
protected SagaException(int order)
order
- initializes the exceptionOrder field that determines which
exception is more specific.protected SagaException(int order, String message)
order
- initializes the exceptionOrder field that determines which
exception is more specific.message
- the detail message.protected SagaException(int order, Throwable cause)
order
- initializes the exceptionOrder field that determines which
exception is more specific.cause
- the cause.protected SagaException(int order, String message, Throwable cause)
order
- initializes the exceptionOrder field that determines which
exception is more specific.message
- the detail message.cause
- the cause.protected SagaException(int order, String message, SagaObject object)
order
- initializes the exceptionOrder field that determines which
exception is more specific.message
- the detail message.object
- the SAGA object associated with the exception.protected SagaException(int order, Throwable cause, SagaObject object)
order
- initializes the exceptionOrder field that determines which
exception is more specific.cause
- the cause.object
- the SAGA object associated with the exception.protected SagaException(int order, String detail, Throwable cause, SagaObject object)
order
- initializes the exceptionOrder field that determines which
exception is more specific.message
- the detail message.cause
- the cause.object
- the SAGA object associated with the exception.public SagaObject getObject() throws DoesNotExistException, NoSuccessException
DoesNotExistException
- is thrown when there is no object associated with this exception.NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.public int compareTo(SagaException o)
compareTo
in interface Comparable<SagaException>
public String toString()
SagaException
.
If this SagaException
object was created with a non-null detail message string,
then the result is the concatenation of three strings:
Throwable.getMessage()
method for this object
SagaException
object was created with a null detail message string,
then only the simple (unqualified) name of the actual class of this object is returned.public void addNestedException(SagaException e)
e
- the exception to be added to the list.public Iterator<SagaException> iterator()
iterator
in interface Iterable<SagaException>
public List<SagaException> getAllExceptions()
Copyright © 2016 Open Grid Forum. All rights reserved.