From b23f0817996ae794d93a437324d11d3bbf0cdadf Mon Sep 17 00:00:00 2001
From: TO
Date: Wed, 15 Jul 2026 22:10:40 +0200
Subject: [PATCH] fix: update HTTP status codes for attachment size exceptions
---
.vscode/settings.json | 3 ++-
backend/pom.xml | 11 +++++++++++
.../backend/controller/ApiExceptionHandler.java | 4 ++--
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 7b016a8..987bd96 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,3 +1,4 @@
{
- "java.compile.nullAnalysis.mode": "automatic"
+ "java.compile.nullAnalysis.mode": "automatic",
+ "java.configuration.updateBuildConfiguration": "automatic"
}
\ No newline at end of file
diff --git a/backend/pom.xml b/backend/pom.xml
index cbf1797..0f9842c 100644
--- a/backend/pom.xml
+++ b/backend/pom.xml
@@ -70,6 +70,17 @@
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+
+ -Xlint:deprecation
+ -Werror
+
+
+
org.springframework.boot
spring-boot-maven-plugin
diff --git a/backend/src/main/java/fr/nessar/lmnporganizer/backend/controller/ApiExceptionHandler.java b/backend/src/main/java/fr/nessar/lmnporganizer/backend/controller/ApiExceptionHandler.java
index 57137e1..ad15b99 100644
--- a/backend/src/main/java/fr/nessar/lmnporganizer/backend/controller/ApiExceptionHandler.java
+++ b/backend/src/main/java/fr/nessar/lmnporganizer/backend/controller/ApiExceptionHandler.java
@@ -13,12 +13,12 @@ import org.springframework.web.multipart.MaxUploadSizeExceededException;
public class ApiExceptionHandler {
@ExceptionHandler(AttachmentTooLargeException.class)
public ResponseEntity handleAttachmentTooLarge(AttachmentTooLargeException exception) {
- return error(HttpStatus.PAYLOAD_TOO_LARGE, exception.getMessage());
+ return error(HttpStatus.CONTENT_TOO_LARGE, exception.getMessage());
}
@ExceptionHandler(MaxUploadSizeExceededException.class)
public ResponseEntity 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)