Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ControllerAdvice
- final class AppExceptionHandler {
- @ExceptionHandler({NotFoundException.class})
- ResponseEntity notFoundHandler(Exception e) {
- return ResponseEntity
- .status(HttpStatus.NOT_FOUND)
- .body(e.getMessage());
- }
- @ExceptionHandler({IOException.class})
- ResponseEntity iOExceptionHandler(Exception e) {
- return ResponseEntity
- .status(HttpStatus.INTERNAL_SERVER_ERROR)
- .body(e.getMessage());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement