Package com.aspectran.utils
Class MultiException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.aspectran.utils.MultiException
- All Implemented Interfaces:
Serializable
Wraps multiple exceptions.
Allows multiple exceptions to be thrown as a single exception.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
getThrowable
(int i) void
Throw a MultiException.void
Throw a MultiException.void
Throw a Runtime exception.int
size()
toString()
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
MultiException
public MultiException()
-
-
Method Details
-
add
-
size
public int size() -
getThrowables
-
getThrowable
-
ifExceptionThrow
Throw a MultiException. If this multi exception is empty then no action is taken. If it contains a single exception that is thrown, otherwise this multi exception is thrown.- Throws:
Exception
- the Error or Exception if nested is 1, or the MultiException itself if nested is more than 1.
-
ifExceptionThrowRuntime
Throw a Runtime exception. If this multi exception is empty then no action is taken. If it contains a single error or runtime exception that is thrown, otherwise this multi exception is thrown, wrapped in a runtime exception.- Throws:
Error
- if this exception contains exactly 1Error
RuntimeException
- if this exception contains 1Throwable
but it is not an error, or it contains more than 1Throwable
of any type
-
ifExceptionThrowMulti
Throw a MultiException. If this multi exception is empty then no action is taken. If it contains a any exceptions then this multi exception is thrown.- Throws:
MultiException
- the MultiException if there are nested exception
-
toString
-