Class ExceptionUtil
java.lang.Object
com.fasterxml.jackson.databind.util.ExceptionUtil
Utility methods for dealing with exceptions/throwables
- Since:
- 2.15
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static <E extends Throwable>
voidprivate static booleanIt is important never to catch allThrowables.static voidrethrowIfFatal(Throwable throwable) It is important never to catch allThrowables.static <T> T
-
Constructor Details
-
ExceptionUtil
private ExceptionUtil()
-
-
Method Details
-
rethrowIfFatal
It is important never to catch allThrowables. Some likeInterruptedExceptionshould be rethrown. Based on scala.util.control.NonFatal. This method should be used with care.If the
Throwableis fatal, it is rethrown, otherwise, this method just returns. The input throwable is thrown if it is anErroror aRuntimeException. Otherwise, the method wraps the throwable in a RuntimeException and throws that.- Parameters:
throwable- to check- Throws:
Error- the input throwable if it is fatalRuntimeException- the input throwable if it is fatal - throws the original throwable if is aRuntimeException. Otherwise, wraps the throwable in a RuntimeException.
-
isFatal
It is important never to catch allThrowables. Some likeInterruptedExceptionshould be rethrown. Based on scala.util.control.NonFatal.- Parameters:
throwable- to check- Returns:
- whether the
Throwableis a fatal error
-
throwSneaky
-
_sneaky
- Throws:
E
-