fix: update HTTP status codes for attachment size exceptions
This commit is contained in:
1 parent
3ca8514231
commit
b23f081799
3 files changed
+15
-3
No files matched your search
@@ -70,6 +70,17 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- Deprecated APIs are forbidden in production and test code. -->
|
||||
<compilerArgs>
|
||||
<arg>-Xlint:deprecation</arg>
|
||||
<arg>-Werror</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
|
||||
+2
-2
@@ -13,12 +13,12 @@ import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
||||
public class ApiExceptionHandler {
|
||||
@ExceptionHandler(AttachmentTooLargeException.class)
|
||||
public ResponseEntity<ApiError> handleAttachmentTooLarge(AttachmentTooLargeException exception) {
|
||||
return error(HttpStatus.PAYLOAD_TOO_LARGE, exception.getMessage());
|
||||
return error(HttpStatus.CONTENT_TOO_LARGE, exception.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(MaxUploadSizeExceededException.class)
|
||||
public ResponseEntity<ApiError> handleMultipartTooLarge() {
|
||||
return error(HttpStatus.PAYLOAD_TOO_LARGE, "Une pièce jointe ne peut pas dépasser 250 Mo.");
|
||||
return error(HttpStatus.CONTENT_TOO_LARGE, "Une pièce jointe ne peut pas dépasser 250 Mo.");
|
||||
}
|
||||
|
||||
@ExceptionHandler(InvalidPhoneNumberException.class)
|
||||
|
||||
Reference in new issue
Block a user