Class WrappingRuntimeException

  • All Implemented Interfaces:
    Serializable

    public class WrappingRuntimeException
    extends FlinkRuntimeException
    A runtime exception that is explicitly used to wrap non-runtime exceptions.

    The exception is recognized (for example by the Task when reporting exceptions as failure causes) and unwrapped to avoid including the wrapper's stack trace in the reports. That way, exception traces are keeping to the important parts.

    See Also:
    Serialized Form
    • 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.