From eb6d4fbbea75e60cdcf4a0e4fc7e666e0b06eb3f Mon Sep 17 00:00:00 2001 From: ZhouXY108 Date: Sun, 11 Dec 2022 02:34:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20DefaultExceptionHandler?= =?UTF-8?q?=EF=BC=8C=E9=98=B2=E6=AD=A2=E5=85=B6=E6=8B=A6=E6=88=AA=E5=85=B6?= =?UTF-8?q?=E5=AE=83=E5=BC=82=E5=B8=B8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plusone/exception/handler/DefaultExceptionHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/DefaultExceptionHandler.java b/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/DefaultExceptionHandler.java index e991bb8..af53870 100644 --- a/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/DefaultExceptionHandler.java +++ b/plusone-basic/plusone-basic-application/src/main/java/xyz/zhouxy/plusone/exception/handler/DefaultExceptionHandler.java @@ -55,7 +55,11 @@ public class DefaultExceptionHandler extends BaseExceptionHandler { HttpStatus.BAD_REQUEST); } - @ExceptionHandler(Exception.class) + @ExceptionHandler({ + IllegalArgumentException.class, + DataAccessException.class, + MethodArgumentNotValidException.class + }) public ResponseEntity handleException(Exception e) { log.error(e.getMessage(), e); return buildExceptionResponse(e);