From da64cd2209efd14c650643fb68a4c4145b6db8f7 Mon Sep 17 00:00:00 2001 From: huangfeng Date: Tue, 21 May 2024 15:20:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A1=A5=E5=85=85=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xymanager_common/exception/GlobalExceptionHandler.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/exception/GlobalExceptionHandler.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/exception/GlobalExceptionHandler.java index 69c39ba..967916a 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/exception/GlobalExceptionHandler.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/exception/GlobalExceptionHandler.java @@ -1,6 +1,7 @@ package com.shxy.xymanager_common.exception; import com.shxy.xymanager_common.base.ResponseReult; +import lombok.extern.slf4j.Slf4j; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import org.springframework.web.bind.MethodArgumentNotValidException; @@ -15,11 +16,13 @@ import java.sql.SQLException; * Created by 晶晶 on 2023/5/8. */ @ControllerAdvice +@Slf4j public class GlobalExceptionHandler { @ResponseBody @ExceptionHandler(value = ApiException.class) public ResponseReult handleApiException(ApiException e) { + log.error(e.getMessage()); if (e.getErrorCode() != null) { return ResponseReult.error(e.getErrorCode()); } @@ -32,6 +35,7 @@ public class GlobalExceptionHandler { @ResponseBody @ExceptionHandler(value = SQLException.class) public ResponseReult handleSQLException(SQLException e) { + log.error("", e); int errorCode = e.getErrorCode(); String message = e.getMessage(); return ResponseReult.fail(errorCode, message); @@ -54,6 +58,7 @@ public class GlobalExceptionHandler { @ResponseBody @ExceptionHandler(value = Exception.class) public ResponseReult handleException(Exception e) { + log.error("", e); String message = e.getMessage(); return ResponseReult.error(message); }