aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www/api/Index.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-01-14 15:42:03 +0300
committerGravatar Vitaly Takmazov2023-01-14 15:42:03 +0300
commit23a41aebadbe13e8992856c6be84ce6d01de0175 (patch)
tree28ccc1446a8d4c1b9141454ea74703e65a9bff22 /src/main/java/com/juick/www/api/Index.java
parent834fef2a7794d769144c7c087a8b1fa0a2a9bb21 (diff)
Configure test coverage reports
Diffstat (limited to 'src/main/java/com/juick/www/api/Index.java')
-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());
+ }
}