aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/www/api')
-rw-r--r--src/main/java/com/juick/www/api/Index.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/com/juick/www/api/Index.java b/src/main/java/com/juick/www/api/Index.java
index 921ebca4..7430c22d 100644
--- a/src/main/java/com/juick/www/api/Index.java
+++ b/src/main/java/com/juick/www/api/Index.java
@@ -19,6 +19,7 @@ package com.juick.www.api;
import io.swagger.v3.oas.annotations.Hidden;
+import jakarta.validation.ConstraintViolationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
@@ -56,4 +57,8 @@ public class Index {
ServletUriComponentsBuilder.fromCurrentRequestUri().build().toUriString());
return ResponseEntity.badRequest().body("Invalid media type");
}
+ @ExceptionHandler(ConstraintViolationException.class)
+ public ResponseEntity<String> badRequest(final ConstraintViolationException exception) {
+ return ResponseEntity.badRequest().body(exception.getMessage());
+ }
}