Class WrappedCheckedException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.github.cowwoc.pouch10.core.WrappedCheckedException
All Implemented Interfaces:
Serializable

public final class WrappedCheckedException extends RuntimeException
A runtime exception dedicated to wrapping checked exceptions.
See Also:
  • Method Details

    • wrap

      public static <V> Supplier<V> wrap(Callable<V> task)
      Wraps any checked exceptions thrown by a Callable.
      Type Parameters:
      V - the type of value returned by task
      Parameters:
      task - the task to execute
      Returns:
      a Callable that does not throw any checked exceptions
      Throws:
      NullPointerException - if task is null
    • wrap

      Wraps any checked exceptions thrown by a ThrowingRunnable.
      Parameters:
      task - the task to execute
      Returns:
      a Runnable
      Throws:
      NullPointerException - if task is null
    • wrap

      public static RuntimeException wrap(Throwable t)
      Wraps an exception, unless it is a RuntimeException.
      Parameters:
      t - the exception to wrap
      Returns:
      the updated exception
      Throws:
      NullPointerException - if t is null
    • wrap

      public static RuntimeException wrap(String message, Throwable t)
      Wraps an exception, unless it is a RuntimeException with the specified message.
      Parameters:
      message - the detail message of the WrappedCheckedException
      t - the exception to wrap
      Returns:
      the updated exception
      Throws:
      NullPointerException - if t is null