org.glassfish.hk2.api
Class MultiException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.glassfish.hk2.api.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:
jwells
See Also:
Serialized Form

Constructor Summary
MultiException()
          Creates an empty MultiException
MultiException(List<Throwable> th)
          This list must have at least one element in it.
MultiException(Throwable th)
          This allows for construction of a MultiException with one element in its list
 
Method Summary
 void addError(Throwable error)
          Adds an error to an existing exception
 List<Throwable> getErrors()
          Gets all the errors associated with this MultiException
 String toString()
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiException

public MultiException()
Creates an empty MultiException


MultiException

public MultiException(List<Throwable> th)
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:
th - A non-null, non-empty list of exceptions

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

toString

public String toString()
Overrides:
toString in class Throwable


Copyright © 2013 Oracle Corporation. All Rights Reserved.