perf(exception): añadido exception handler para excepción del límite de peticiones a la IA

parent 83573807
...@@ -27,12 +27,13 @@ public class ExceptionController { ...@@ -27,12 +27,13 @@ public class ExceptionController {
} }
@ExceptionHandler(PythonApiException.class) @ExceptionHandler(PythonApiException.class)
@ResponseStatus(HttpStatus.TOO_MANY_REQUESTS)
public ResponseEntity<ErrorMessage> handle(PythonApiException ex) { public ResponseEntity<ErrorMessage> handle(PythonApiException ex) {
return ResponseEntity return ResponseEntity
.status(ex.getStatus()). .status(ex.getStatus()).
body(new ErrorMessage( body(new ErrorMessage(
LocalDateTime.now(), LocalDateTime.now(),
ex.getStatus().value(), HttpStatus.TOO_MANY_REQUESTS.value(),
ex.getMessage() ex.getMessage()
)); ));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment