package com.loan.system.exception;

import com.loan.system.domain.enums.ExceptionEnum;
import org.springframework.security.core.AuthenticationException;

/**
 * @author xuhong
 * @date 2020/9/8 - 12:49
 * @Description 登录错误类
 */
public class LoginException extends AuthenticationException {
    private static final long serialVersionUID = 716346130825379873L;
    private Integer code;

    public LoginException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }
    public LoginException(ExceptionEnum exceptionEnum){
        super(exceptionEnum.getMsg());
        this.code = exceptionEnum.getCode();
    }

    public Integer getCode() {
        return code;
    }

    public LoginException setCode(Integer code) {
        this.code = code;
        return this;
    }
}
