Class WrappedException

  • All Implemented Interfaces:
    java.io.Serializable

    public final class WrappedException
    extends java.lang.RuntimeException
    A simple unchecked exception wrapper for wrapping checked Exception types. Throwable types are not handled since Throwable includes system errors like OutOfMemoryError.
    Author:
    Ramsey Gurley
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Exception getCause()
      Overridden to return Exception types instead of Throwable.
      static WrappedException wrap​(java.lang.Exception e)
      Factory method to generate a WrappedException.
      static WrappedException wrap​(java.lang.String message, java.lang.Exception e)
      Factory method to generate a WrappedException.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getCause

        public java.lang.Exception getCause()
        Overridden to return Exception types instead of Throwable.
        Overrides:
        getCause in class java.lang.Throwable
        Returns:
        an Exception
      • wrap

        public static WrappedException wrap​(java.lang.String message,
                                            java.lang.Exception e)
        Factory method to generate a WrappedException. If the Exception argument is itself a WrappedException, the cause of that argument is rewrapped with the new message argument.
        Parameters:
        message - the exception message
        e - the original exception
        Returns:
        a new WrappedException
      • wrap

        public static WrappedException wrap​(java.lang.Exception e)
        Factory method to generate a WrappedException. If the Exception argument is itself a WrappedException, the cause of that argument is rewrapped.
        Parameters:
        e - the original exception
        Returns:
        a new WrappedException