Class UnhandledExceptionResolver

  • All Implemented Interfaces:
    org.springframework.web.servlet.HandlerExceptionResolver

    public class UnhandledExceptionResolver
    extends Object
    implements org.springframework.web.servlet.HandlerExceptionResolver
    Resolver used when no other resolver can intervene.

    This is essentially delegating work to a SimpleMappingExceptionResolver with the added benefit that the exception can be logged beforehand with a given error category.

    Author:
    poirigui
    See Also:
    SimpleMappingExceptionResolver
    • Constructor Detail

      • UnhandledExceptionResolver

        public UnhandledExceptionResolver()
    • Method Detail

      • resolveException

        public org.springframework.web.servlet.ModelAndView resolveException​(javax.servlet.http.HttpServletRequest request,
                                                                             javax.servlet.http.HttpServletResponse response,
                                                                             Object handler,
                                                                             Exception ex)
        Specified by:
        resolveException in interface org.springframework.web.servlet.HandlerExceptionResolver
      • setErrorCategory

        public void setErrorCategory​(@Nullable
                                     String loggerName)
        Set the name of the logger to use for reporting unhandled exceptions.

        By default, no logging is done.

        See Also:
        AbstractHandlerExceptionResolver.setWarnLogCategory(String)
      • setStatusCode

        public void setStatusCode​(int statusCode)
        Set the status code to use for reporting unhandled exception.

        Defaults to 500.

        See Also:
        SimpleMappingExceptionResolver.setDefaultStatusCode(int)
      • setErrorView

        public void setErrorView​(String errorView)
        Set the view to use for reporting unhandled exception.

        Default is none.

        See Also:
        SimpleMappingExceptionResolver.setDefaultErrorView(String)