From b1380add200693b935c1a07c75b0d4af1e5881ad Mon Sep 17 00:00:00 2001 From: thinkgem Date: Fri, 13 Jul 2018 22:06:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=94=99=E8=AF=AF=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/src/main/resources/views/error/403.html | 7 +++++-- .../core/src/main/resources/views/error/500.html | 16 ++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/modules/core/src/main/resources/views/error/403.html b/modules/core/src/main/resources/views/error/403.html index 8f817325..040001ba 100644 --- a/modules/core/src/main/resources/views/error/403.html +++ b/modules/core/src/main/resources/views/error/403.html @@ -6,8 +6,11 @@ var message = @ObjectUtils.toString(@request.getAttribute("message")); if (isBlank(message)){ var ex = @ExceptionUtils.getThrowable(request); if (ex != null){ - if(@StringUtils.startsWith(@ex.getMessage(), "msg:")){ - message = @StringUtils.replace(@ex.getMessage(), "msg:", ""); + for (e in [ex, ex.cause!, ex.cause.cause!]){ + if (@StringUtils.startsWith(e.message!, "msg:")){ + message = @StringUtils.replace(e.message!, "msg:", ""); + break; + } } } } diff --git a/modules/core/src/main/resources/views/error/500.html b/modules/core/src/main/resources/views/error/500.html index d5a70ffb..f3b381bd 100644 --- a/modules/core/src/main/resources/views/error/500.html +++ b/modules/core/src/main/resources/views/error/500.html @@ -7,14 +7,14 @@ var ex; if (isBlank(message)){ ex = @ExceptionUtils.getThrowable(request); if (ex != null){ - if (@StringUtils.startsWith(ex.message, "msg:")){ - message = @StringUtils.replace(ex.message, "msg:", ""); - }else if (@StringUtils.startsWith(ex.cause.message!, "msg:")){ - message = @StringUtils.replace(ex.cause.message!, "msg:", ""); - }else if (ex.class.name == 'com.jeesite.common.service.ServiceException'){ - message = ex.message; - }else if (ex.cause.class.name! == 'com.jeesite.common.service.ServiceException'){ - message = ex.cause.message!; + for (e in [ex, ex.cause!, ex.cause.cause!]){ + if (@StringUtils.startsWith(e.message!, "msg:")){ + message = @StringUtils.replace(e.message!, "msg:", ""); + break; + }else if (e.class.name! == 'com.jeesite.common.service.ServiceException'){ + message = e.message!; + break; + } } @org.slf4j.LoggerFactory.getLogger("error/500").error(ex.message, ex); }