From 67cf9dfbf8a9920dc00e7ec7630b1374f6358c33 Mon Sep 17 00:00:00 2001 From: lihengming <89921218@qq.com> Date: Tue, 4 Jul 2017 12:14:23 +0800 Subject: [PATCH] update > controller template & exception handler for issue #13 --- .../java/com/company/project/configurer/WebMvcConfigurer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/company/project/configurer/WebMvcConfigurer.java b/src/main/java/com/company/project/configurer/WebMvcConfigurer.java index 3125567..161c1c8 100644 --- a/src/main/java/com/company/project/configurer/WebMvcConfigurer.java +++ b/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();