java.lang.Object
tools.jackson.databind.util.ExceptionUtil
Utility methods for dealing with exceptions/throwables
- Since:
- 2.15
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidrethrowIfFatal(Throwable throwable) It is important never to catch allThrowables.static <ERR extends Throwable>
ERRrethrowIfNoWrap(DeserializationContext ctxt, ERR e) Helper method that will either throw given throwable -- if (and only if) one of following is true: 1.
-
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.
-
rethrowIfNoWrap
Helper method that will either throw given throwable -- if (and only if) one of following is true: 1. It is anError2. It is aJacksonException3.DeserializationFeature.WRAP_EXCEPTIONSis NOT enabled AND exception is aRuntimeException-- or (otherwise) returns throwable as-is.- Parameters:
ctxt- Current deserialization contexte- Exception caught to possibly re-throw- Returns:
- Exception passed in for call chaining
- Since:
- 3.1
-