Advertisement
Mr_Max

Untitled

Dec 5th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. @ControllerAdvice
  2. public class ExceptionHandlingController implements ErrorController{
  3.  
  4.     private final static String ERROR_PATH = "/error";
  5.  
  6.     @ExceptionHandler({SQLException.class, DataAccessException.class})
  7.     public String databaseError() {
  8.         return "for-other";
  9.     }
  10.  
  11.     @ExceptionHandler(Throwable.class)
  12.     public String excepting() {
  13.         return "for-other";
  14.     }
  15.  
  16.     @Override
  17.     public String getErrorPath() {
  18.         return ERROR_PATH;
  19.     }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement