Class WrappingRuntimeException

    • Constructor Detail

      • WrappingRuntimeException

        public WrappingRuntimeException​(@Nonnull
                                        Throwable cause)
      • WrappingRuntimeException

        public WrappingRuntimeException​(String message,
                                        @Nonnull
                                        Throwable cause)
    • Method Detail

      • unwrap

        public Throwable unwrap()
        Recursively unwraps this WrappingRuntimeException and its causes, getting the first non wrapping exception.
        Returns:
        The first cause that is not a wrapping exception.
      • wrapIfNecessary

        public static RuntimeException wrapIfNecessary​(Throwable throwable)
        Ensures that any throwable can be thrown as a checked exception by potentially wrapping it.
        Returns:
        a runtime exception wrapping the throwable if checked or by returning the throwable if it's a runtime exception.