ExceptionRecognizerForType

A specific implementation of ExceptionRecognizer that looks for an exception of the type provided in the constructor and, if found anywhere in the causal chain, then returns a non-null message indicating that the exception has been recognized.

If a messaging-parsing Function is provided through the constructor, then the message can be altered. Otherwise the exception’s Throwable#getMessage() message is returned as-is.

API

ExceptionRecognizerForType.java
class ExceptionRecognizerForType {
  ExceptionRecognizerForType(Category category, Class<? extends Exception> exceptionType, Function<Throwable, String> rootCauseMessageFormatter)
  ExceptionRecognizerForType(Category category, Predicate<Throwable> predicate, Function<Throwable, String> rootCauseMessageFormatter)
  ExceptionRecognizerForType(Category category, Class<? extends Exception> exceptionType)
  ExceptionRecognizerForType(Class<? extends Exception> exceptionType, Function<Throwable, String> rootCauseMessageFormatter)
  ExceptionRecognizerForType(Predicate<Throwable> predicate, Function<Throwable, String> rootCauseMessageFormatter)
  ExceptionRecognizerForType(Class<? extends Exception> exceptionType)
}