use of cn.taketoday.web.handler.HandlerExceptionHandler in project today-framework by TAKETODAY.
the class WebApplicationLoader method configureExceptionHandler.
/**
* configure HandlerExceptionHandler
*
* @param handlers handlers in application-context {@link #obtainApplicationContext()}
*/
protected void configureExceptionHandler(List<HandlerExceptionHandler> handlers, WebMvcConfiguration mvcConfiguration) {
DispatcherHandler dispatcherHandler = obtainDispatcher();
HandlerExceptionHandler exceptionHandler = dispatcherHandler.getExceptionHandler();
if (exceptionHandler != null) {
handlers.add(exceptionHandler);
}
// user config
mvcConfiguration.configureExceptionHandlers(handlers);
// at least one exception-handler
if (handlers.size() == 1) {
exceptionHandler = handlers.get(0);
} else {
// @since 3.0.3 exception handlers order
sort(handlers);
exceptionHandler = new CompositeHandlerExceptionHandler(handlers);
}
// set
dispatcherHandler.setExceptionHandler(exceptionHandler);
}
Aggregations