java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.github.nullterminated.trylambda.WrappedException
All Implemented Interfaces:
Serializable

public final class WrappedException extends 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:
  • Method Details

    • getCause

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

      public static WrappedException wrap(String message, 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(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