From d4ecf2b44f968f0fafdcc06c9b9ff5d8c802586a Mon Sep 17 00:00:00 2001 From: tkdwns414 Date: Tue, 10 Sep 2024 02:51:47 +0900 Subject: [PATCH] [fix] #144 handle HttpMessageNotReadableException in GlobalExceptionHandler --- .../kkumulkkum/server/advice/GlobalExceptionHandler.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/kkumulkkum/server/advice/GlobalExceptionHandler.java b/src/main/java/org/kkumulkkum/server/advice/GlobalExceptionHandler.java index 7bcbbcc..15329b2 100644 --- a/src/main/java/org/kkumulkkum/server/advice/GlobalExceptionHandler.java +++ b/src/main/java/org/kkumulkkum/server/advice/GlobalExceptionHandler.java @@ -4,6 +4,7 @@ import org.kkumulkkum.server.exception.*; import org.kkumulkkum.server.exception.code.*; import org.springframework.http.ResponseEntity; +import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.MissingRequestHeaderException; @@ -109,7 +110,11 @@ public ResponseEntity handleNoPageFoundException(HttpRequestM .body(BusinessErrorCode.METHOD_NOT_ALLOWED); } - @ExceptionHandler(value = {HandlerMethodValidationException.class, MethodArgumentNotValidException.class}) + @ExceptionHandler(value = { + HandlerMethodValidationException.class, + MethodArgumentNotValidException.class, + HttpMessageNotReadableException.class + }) public ResponseEntity handleValidationException(Exception e) { log.warn("GlobalExceptionHandler catch MethodArgumentNotValidException : {}", e.getMessage()); return ResponseEntity