Change Exception Handler for Exception to RuntimeException.

This commit is contained in:
Konstantinos Triantafyllou 2024-09-10 10:28:18 +03:00
parent d035cf4cc6
commit d09e6f5b8a
1 changed files with 2 additions and 2 deletions

View File

@ -24,8 +24,8 @@ public class ExceptionsHandler {
return new ResponseEntity<>(new ExceptionResponse(ex, ex.getHttpStatus()), ex.getHttpStatus());
}
@ExceptionHandler(Exception.class)
public ResponseEntity<?> exception(Exception ex) {
@ExceptionHandler(RuntimeException.class)
public ResponseEntity<?> exception(RuntimeException ex) {
log.error(ex.getMessage(), ex);
return new ResponseEntity<>(new ExceptionResponse(ex, HttpStatus.BAD_REQUEST), HttpStatus.BAD_REQUEST);
}