package com.unis.crk.basic.exception;

import com.unis.crk.enums.ResultEnum;
import org.apache.ibatis.executor.ErrorContext;

public class UserLoginException extends RuntimeException{
    private static final long serialVersionUID = 6958499248468627021L;
    /** 错误码 */
    private Integer errorCode;
    /** 错误上下文 */
    private ErrorContext errorContext;


    public UserLoginException(Integer errorCode, String errorMsg){
        super(errorMsg);
        this.errorCode = errorCode;
    }

    public UserLoginException(ResultEnum systemCodeAndMsg){
        super(systemCodeAndMsg.CODE_8.getMsg());
        this.errorCode = systemCodeAndMsg.CODE_8.getCode();
    }

    public UserLoginException(Integer errorCode, String errorMsg, Throwable throwable){
        super(errorMsg,throwable);
        this.errorCode = errorCode;
    }

    public UserLoginException(ResultEnum systemCodeAndMsg, Throwable throwable){
        super(systemCodeAndMsg.getMsg(),throwable);
        this.errorCode = systemCodeAndMsg.getCode();
    }
    /**
     * Getter method for property <tt>errorCode</tt>.
     *
     * @return property value of errorCode
     */
    public Integer getErrorCode() {
        return errorCode;
    }

    /**
     * Setter method for property <tt>errorCode</tt>.
     *
     * @param errorCode value to be assigned to property errorCode
     */
    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }


    /**
     * Getter method for property <tt>errorContext</tt>.
     *
     * @return property value of errorContext
     */
    public ErrorContext getErrorContext() {
        return errorContext;
    }

    /**
     * Setter method for property <tt>errorContext</tt>.
     *
     * @param errorContext value to be assigned to property errorContext
     */
    public void setErrorContext(ErrorContext errorContext) {
        this.errorContext = errorContext;
    }

}
