From 2573c7a1ed67aea84ff223e67230ba73c99dd468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E7=8E=89=E7=A5=A5?= Date: Thu, 6 Oct 2022 23:19:23 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xiaonuo/common/util/CommonFilterExceptionUtil.java | 9 +-------- .../xiaonuo/core/handler/GlobalErrorViewController.java | 2 ++ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/snowy-common/src/main/java/vip/xiaonuo/common/util/CommonFilterExceptionUtil.java b/snowy-common/src/main/java/vip/xiaonuo/common/util/CommonFilterExceptionUtil.java index deaca2c9..9bd3b00c 100644 --- a/snowy-common/src/main/java/vip/xiaonuo/common/util/CommonFilterExceptionUtil.java +++ b/snowy-common/src/main/java/vip/xiaonuo/common/util/CommonFilterExceptionUtil.java @@ -12,9 +12,6 @@ */ package vip.xiaonuo.common.util; -import cn.hutool.core.util.ObjectUtil; -import vip.xiaonuo.common.exception.CommonException; - import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; @@ -35,11 +32,7 @@ public class CommonFilterExceptionUtil { **/ public static void handleFilterException(ServletRequest request, ServletResponse response, Exception e) { try { - if(ObjectUtil.isNotEmpty(e.getMessage())) { - request.setAttribute("model", new CommonException(e.getMessage())); - } else { - request.setAttribute("model", e); - } + request.setAttribute("model", e); request.getRequestDispatcher("/errorView").forward(request, response); } catch (Exception ignored) { } diff --git a/snowy-web-app/src/main/java/vip/xiaonuo/core/handler/GlobalErrorViewController.java b/snowy-web-app/src/main/java/vip/xiaonuo/core/handler/GlobalErrorViewController.java index a6a3b5c2..1cfd2517 100644 --- a/snowy-web-app/src/main/java/vip/xiaonuo/core/handler/GlobalErrorViewController.java +++ b/snowy-web-app/src/main/java/vip/xiaonuo/core/handler/GlobalErrorViewController.java @@ -53,6 +53,8 @@ public class GlobalErrorViewController { } else { commonResult = CommonResult.error(); } + Exception exception = (Exception) model; + exception.printStackTrace(); } log.error(">>> {}", commonResult.getMsg()); return commonResult;