diff --git a/src/main/java/com/moabam/global/error/handler/GlobalExceptionHandler.java b/src/main/java/com/moabam/global/error/handler/GlobalExceptionHandler.java index d45037c4..4d68a475 100644 --- a/src/main/java/com/moabam/global/error/handler/GlobalExceptionHandler.java +++ b/src/main/java/com/moabam/global/error/handler/GlobalExceptionHandler.java @@ -1,6 +1,8 @@ package com.moabam.global.error.handler; -import static com.moabam.global.error.model.ErrorMessage.*; +import static com.moabam.global.error.model.ErrorMessage.INVALID_REQUEST_FIELD; +import static com.moabam.global.error.model.ErrorMessage.INVALID_REQUEST_VALUE_TYPE_FORMAT; +import static com.moabam.global.error.model.ErrorMessage.S3_INVALID_IMAGE_SIZE; import java.util.HashMap; import java.util.List; @@ -14,6 +16,7 @@ import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; +import org.springframework.web.multipart.MaxUploadSizeExceededException; import com.moabam.global.error.exception.BadRequestException; import com.moabam.global.error.exception.ConflictException; @@ -99,4 +102,12 @@ public ErrorResponse handleMethodArgumentTypeMismatchException(MethodArgumentTyp return new ErrorResponse(message, null); } + + @ExceptionHandler(MaxUploadSizeExceededException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + public ErrorResponse handleMaxSizeException(MaxUploadSizeExceededException exception) { + String message = String.format(S3_INVALID_IMAGE_SIZE.getMessage()); + + return new ErrorResponse(message, null); + } } diff --git a/src/main/resources/config b/src/main/resources/config index 4dbde487..c9c58dc4 160000 --- a/src/main/resources/config +++ b/src/main/resources/config @@ -1 +1 @@ -Subproject commit 4dbde487226312c2a144165aa28c0cc0b1e7a0bf +Subproject commit c9c58dc4c9fbcd88ca2ae51e09b883e296bd3db9