update > controller template & exception handler for issue #13

master
lihengming 8 years ago
parent 1e8e1bdd6a
commit 67cf9dfbf8
  1. 4
      src/main/java/com/company/project/configurer/WebMvcConfigurer.java

@ -71,6 +71,7 @@ public class WebMvcConfigurer extends WebMvcConfigurerAdapter {
} else if (e instanceof ServletException) {
result.setCode(ResultCode.FAIL).setMessage(e.getMessage());
} else {
result.setCode(ResultCode.INTERNAL_SERVER_ERROR).setMessage("接口 [" + request.getRequestURI() + "] 内部错误,请联系管理员");
String message;
if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
@ -82,8 +83,7 @@ public class WebMvcConfigurer extends WebMvcConfigurerAdapter {
} else {
message = e.getMessage();
}
result.setCode(ResultCode.INTERNAL_SERVER_ERROR).setMessage(message);
logger.error(e.getMessage(), e);
logger.error(message, e);
}
responseResult(response, result);
return new ModelAndView();

Loading…
Cancel
Save