This commit is contained in:
Struchkov Mark 2022-06-17 23:27:28 +03:00
parent 0b47b9b925
commit cbc0def973

View File

@ -12,14 +12,14 @@ import org.springframework.web.method.annotation.MethodArgumentTypeMismatchExcep
public class ExceptionApiHandler { public class ExceptionApiHandler {
@ExceptionHandler(NotFoundException.class) @ExceptionHandler(NotFoundException.class)
public ResponseEntity<ErrorMessage> authException(NotFoundException exception) { public ResponseEntity<ErrorMessage> notFoundException(NotFoundException exception) {
return ResponseEntity return ResponseEntity
.status(HttpStatus.NOT_FOUND) .status(HttpStatus.NOT_FOUND)
.body(new ErrorMessage(exception.getMessage())); .body(new ErrorMessage(exception.getMessage()));
} }
@ExceptionHandler(MethodArgumentTypeMismatchException.class) @ExceptionHandler(MethodArgumentTypeMismatchException.class)
public ResponseEntity<ErrorMessage> authException(MethodArgumentTypeMismatchException exception) { public ResponseEntity<ErrorMessage> mismatchException(MethodArgumentTypeMismatchException exception) {
return ResponseEntity return ResponseEntity
.status(HttpStatus.NOT_FOUND) .status(HttpStatus.NOT_FOUND)
.body(new ErrorMessage(exception.getMessage())); .body(new ErrorMessage(exception.getMessage()));