Class MultiException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.glassfish.jersey.inject.weld.internal.injector.MultiException
-
- All Implemented Interfaces:
Serializable
public class MultiException extends RuntimeException
This exception can contain multiple other exceptions. However, it will also have the causal chain of the first exception added to the list of exceptions.- Author:
- John Wells (john.wells at oracle.com)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MultiException()Creates an empty MultiException.MultiException(Throwable th)This allows for construction of a MultiException with one element in its list.MultiException(Throwable th, boolean reportToErrorService)This allows for construction of a MultiException with one element in its list.MultiException(List<Throwable> ths)This list must have at least one element in it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddError(Throwable error)Adds an error to an existing exception.List<Throwable>getErrors()Gets all the errors associated with this MultiException.StringgetMessage()Gets the message associated with this exception.booleangetReportToErrorService()Returns true if this exception should be reported to the error service when thrown during a creation or deletion of a service.voidprintStackTrace(PrintStream s)Prints the stack trace of this exception to the given PrintStream.voidprintStackTrace(PrintWriter s)Prints the stack trace of this exception to the given PrintWriter.voidsetReportToErrorService(boolean report)Sets if this exception should be reported to the error service when thrown during a creation or deletion of a service.StringtoString()-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace
-
-
-
-
Constructor Detail
-
MultiException
public MultiException()
Creates an empty MultiException.
-
MultiException
public MultiException(List<Throwable> ths)
This list must have at least one element in it. The first element of the list will become the cause of this exception, and its message will become the message of this exception.- Parameters:
ths- A non-null, non-empty list of exceptions.
-
MultiException
public MultiException(Throwable th, boolean reportToErrorService)
This allows for construction of a MultiException with one element in its list.- Parameters:
th- May not be null.
-
MultiException
public MultiException(Throwable th)
This allows for construction of a MultiException with one element in its list.- Parameters:
th- May not be null.
-
-
Method Detail
-
getErrors
public List<Throwable> getErrors()
Gets all the errors associated with this MultiException.- Returns:
- All the errors associated with this MultiException. Will not return null, but may return an empty object.
-
addError
public void addError(Throwable error)
Adds an error to an existing exception.- Parameters:
error- The exception to add.
-
getMessage
public String getMessage()
Gets the message associated with this exception.- Overrides:
getMessagein classThrowable
-
printStackTrace
public void printStackTrace(PrintStream s)
Prints the stack trace of this exception to the given PrintStream.- Overrides:
printStackTracein classThrowable
-
printStackTrace
public void printStackTrace(PrintWriter s)
Prints the stack trace of this exception to the given PrintWriter.- Overrides:
printStackTracein classThrowable
-
getReportToErrorService
public boolean getReportToErrorService()
Returns true if this exception should be reported to the error service when thrown during a creation or deletion of a service.- Returns:
- true if this exception should be reported to the error service when creating or deleting a service.
-
setReportToErrorService
public void setReportToErrorService(boolean report)
Sets if this exception should be reported to the error service when thrown during a creation or deletion of a service.- Parameters:
report- true if this exception should be reported to the error service when creating or deleting a service.
-
-