Search in sources :

Example 1 with InternalServerError

use of com.navercorp.pinpoint.web.view.error.InternalServerError in project pinpoint by naver.

the class ControllerExceptionHandler method defaultErrorHandler.

@ExceptionHandler(value = Exception.class)
public ModelAndView defaultErrorHandler(HttpServletRequest request, Exception exception) throws Exception {
    Objects.requireNonNull(request, "request");
    Objects.requireNonNull(exception, "exception");
    InternalServerError.RequestInfo requestInfo = createRequestResource(request);
    logger.warn("Failed to execute controller methods. message:{}, request:{}.", exception.getMessage(), requestInfo, exception);
    ModelAndView mav = new ModelAndView();
    InternalServerError error = createExceptionResource(requestInfo, exception);
    mav.addObject("exception", error);
    mav.setViewName(DEFAULT_ERROR_VIEW);
    mav.setStatus(HttpStatus.INTERNAL_SERVER_ERROR);
    return mav;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) InternalServerError(com.navercorp.pinpoint.web.view.error.InternalServerError) ExceptionHandler(org.springframework.web.bind.annotation.ExceptionHandler)

Aggregations

InternalServerError (com.navercorp.pinpoint.web.view.error.InternalServerError)1 ExceptionHandler (org.springframework.web.bind.annotation.ExceptionHandler)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1