diff --git a/app/api/mathrank-api-common/src/main/java/kr/co/mathrank/app/api/common/exception/ApiExceptionHandler.java b/app/api/mathrank-api-common/src/main/java/kr/co/mathrank/app/api/common/exception/ApiExceptionHandler.java index 2486a3aa..ea83b0ec 100644 --- a/app/api/mathrank-api-common/src/main/java/kr/co/mathrank/app/api/common/exception/ApiExceptionHandler.java +++ b/app/api/mathrank-api-common/src/main/java/kr/co/mathrank/app/api/common/exception/ApiExceptionHandler.java @@ -6,6 +6,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.method.annotation.HandlerMethodValidationException; import jakarta.servlet.ServletException; import jakarta.validation.ConstraintViolationException; @@ -26,6 +27,13 @@ public ResponseEntity handleValidationException(final Constrai .body(ApiExceptionBody.of(1000, exception.getMessage())); } + @ExceptionHandler(HandlerMethodValidationException.class) + public ResponseEntity handleValidationException(final HandlerMethodValidationException exception) { + log.warn("[ApiExceptionHandler] wrong arguments: {}", exception.getCrossParameterValidationResults(), exception); + return ResponseEntity.status(API_EXCEPTION_STATUS) + .body(ApiExceptionBody.of(1000, exception.getMessage())); + } + @ExceptionHandler({ServletException.class, HttpMessageNotReadableException.class, MethodArgumentNotValidException.class}) public ResponseEntity handleServletException(final Exception exception) { log.warn("[ApiExceptionHandler] wrong api access with: {}", exception.getMessage(), exception);