-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GETP-310 feat: 파일 업로드 최대 용량 5MB로 변경 (#179)
- Loading branch information
Showing
4 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/main/java/es/princip/getp/api/handler/MaxUploadSizeExceededExceptionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package es.princip.getp.api.handler; | ||
|
||
import es.princip.getp.api.support.dto.ApiErrorResponse; | ||
import es.princip.getp.api.support.dto.ApiErrorResponse.ApiErrorResult; | ||
import es.princip.getp.domain.support.ErrorDescription; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
import org.springframework.web.multipart.MaxUploadSizeExceededException; | ||
|
||
@Slf4j | ||
@Order(1) | ||
@RestControllerAdvice | ||
public class MaxUploadSizeExceededExceptionHandler { | ||
|
||
@ExceptionHandler(MaxUploadSizeExceededException.class) | ||
public ResponseEntity<ApiErrorResult> handle(final MaxUploadSizeExceededException exception) { | ||
log.debug(exception.getMessage(), exception); | ||
final ErrorDescription description = ErrorDescription.of( | ||
"MAX_UPLOAD_SIZE_EXCEEDED", | ||
"최대 허용 파일 크기를 초과했습니다. " | ||
); | ||
return ApiErrorResponse.error(HttpStatus.PAYLOAD_TOO_LARGE, description); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters