spring-framework / org.springframework.web.method.annotation / ExceptionHandlerMethodResolver

ExceptionHandlerMethodResolver

open class ExceptionHandlerMethodResolver

Discovers ExceptionHandler methods in a given class, including all of its superclasses, and helps to resolve a given Exception to the exception types supported by a given Method.

Author
Rossen Stoyanchev

Author
Juergen Hoeller

Since
3.1

Constructors

<init>

ExceptionHandlerMethodResolver(handlerType: Class<*>)

A constructor that finds ExceptionHandler methods in the given type.

Properties

EXCEPTION_HANDLER_METHODS

static val EXCEPTION_HANDLER_METHODS: MethodFilter

A filter for selecting @ExceptionHandler methods.

Functions

hasExceptionMappings

open fun hasExceptionMappings(): Boolean

Whether the contained type has any exception mappings.

resolveMethod

open fun resolveMethod(exception: Exception): Method

Find a Method to handle the given exception. Use ExceptionDepthComparator if more than one match is found.

resolveMethodByExceptionType

open fun resolveMethodByExceptionType(exceptionType: Class<out Throwable>): Method

Find a Method to handle the given exception type. This can be useful if an Exception instance is not available (e.g. for tools).

resolveMethodByThrowable

open fun resolveMethodByThrowable(exception: Throwable): Method

Find a Method to handle the given Throwable. Use ExceptionDepthComparator if more than one match is found.