Package org.apache.flink.util
Class WrappingRuntimeException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.apache.flink.util.FlinkRuntimeException
-
- org.apache.flink.util.WrappingRuntimeException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ExceptionInChainedOperatorException
,ExceptionInMultipleInputOperatorException
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 Summary
Constructors Constructor Description WrappingRuntimeException(String message, Throwable cause)
WrappingRuntimeException(Throwable cause)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Throwable
unwrap()
Recursively unwraps this WrappingRuntimeException and its causes, getting the first non wrapping exception.static RuntimeException
wrapIfNecessary(Throwable throwable)
Ensures that any throwable can be thrown as a checked exception by potentially wrapping it.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
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.
-
-