package web.controller;

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


/**
 * 全局异常捕获控制器
 */
@ControllerAdvice
public class UsersLoginExceptionController {
    @ExceptionHandler(exception.UsersException.class)
    public String userLoginException(Model model, Exception e){
        model.addAttribute("message",e.getMessage());
        return "login";
    }

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