From 86bb9a340a27d296a819fbec3c223fbe0ecfe7f3 Mon Sep 17 00:00:00 2001 From: 101 Date: Thu, 1 Feb 2024 20:54:52 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/exception/GlobalExceptionHandler.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/example/daemawiki/global/error/exception/GlobalExceptionHandler.java b/src/main/java/com/example/daemawiki/global/error/exception/GlobalExceptionHandler.java index bc4f2d03..200bc65b 100644 --- a/src/main/java/com/example/daemawiki/global/error/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/example/daemawiki/global/error/exception/GlobalExceptionHandler.java @@ -7,6 +7,7 @@ import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.bind.support.WebExchangeBindException; import reactor.core.publisher.Mono; @RestControllerAdvice @@ -20,8 +21,8 @@ public Mono> handleGlobalException(CustomException .body(errorResponse)); } - @ExceptionHandler(MethodArgumentNotValidException.class) - public Mono> handleValidException(MethodArgumentNotValidException e) { + @ExceptionHandler(WebExchangeBindException.class) + public Mono> handleValidException(WebExchangeBindException e) { FieldError fieldError = e.getBindingResult().getFieldError(); int status = HttpStatus.BAD_REQUEST.value(); String message = fieldError != null ? fieldError.getDefaultMessage() : "Bad Request";