AuthException.java 957 字节
Newer Older
智布道's avatar
智布道 已提交
1 2
package me.zhyd.oauth.exception;

智布道's avatar
智布道 已提交
3
import me.zhyd.oauth.model.AuthResponseStatus;
智布道's avatar
智布道 已提交
4 5 6 7 8 9 10

/**
 * @author yadong.zhang (yadong.zhang0415(a)gmail.com)
 * @version 1.0
 * @since 1.8
 */
public class AuthException extends RuntimeException {
11 12 13 14 15

    private int errorCode;
    private String errorMsg;

    public AuthException(String errorMsg) {
智布道's avatar
智布道 已提交
16
        this(AuthResponseStatus.FAILURE.getCode(), errorMsg);
智布道's avatar
智布道 已提交
17 18
    }

19
    public AuthException(int errorCode, String errorMsg) {
智布道's avatar
智布道 已提交
20
        super(errorMsg);
21 22
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
智布道's avatar
智布道 已提交
23 24
    }

智布道's avatar
智布道 已提交
25
    public AuthException(AuthResponseStatus status) {
智布道's avatar
智布道 已提交
26 27 28 29 30 31 32
        super(status.getMsg());
    }

    public AuthException(String message, Throwable cause) {
        super(message, cause);
    }

智布道's avatar
智布道 已提交
33 34 35 36
    public AuthException(Throwable cause) {
        super(cause);
    }

37 38
    public int getErrorCode() {
        return errorCode;
智布道's avatar
智布道 已提交
39 40
    }

41 42
    public String getErrorMsg() {
        return errorMsg;
智布道's avatar
智布道 已提交
43 44
    }
}