package com.bjsxt.web.controller;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class GlobalExceptionController {


    @ExceptionHandler({com.bjsxt.exception.UsersNotFoundException.class})
    public String UsersNotFoundExceptionHandler(Exception e , Model model){

        String message = e.getMessage();
        model.addAttribute("msg",message);

        return "login";
    }

    @ExceptionHandler({java.lang.Exception.class})
    public String exceptionHandler(){
        return "redirect:/page/error";
    }



}
