47 lines
969 B
Java
47 lines
969 B
Java
![]() |
package com.sf.oauth.exception;
|
||
|
|
||
|
|
||
|
import com.sf.oauth.config.AuthSource;
|
||
|
|
||
|
/**
|
||
|
* 授权异常
|
||
|
*
|
||
|
* @author zoukun
|
||
|
*/
|
||
|
public class AuthException extends RuntimeException {
|
||
|
|
||
|
private int errorCode;
|
||
|
private String errorMsg;
|
||
|
|
||
|
public AuthException(String errorMsg) {
|
||
|
super(errorMsg);
|
||
|
this.errorMsg = errorMsg;
|
||
|
}
|
||
|
|
||
|
public AuthException(int errorCode, String errorMsg) {
|
||
|
super(errorMsg);
|
||
|
this.errorCode = errorCode;
|
||
|
this.errorMsg = errorMsg;
|
||
|
}
|
||
|
|
||
|
public AuthException(int errorCode, String errorMsg, AuthSource source) {
|
||
|
this(errorCode, String.format("%s [%s]", errorMsg, source.getName()));
|
||
|
}
|
||
|
|
||
|
public AuthException(String message, Throwable cause) {
|
||
|
super(message, cause);
|
||
|
}
|
||
|
|
||
|
public AuthException(Throwable cause) {
|
||
|
super(cause);
|
||
|
}
|
||
|
|
||
|
public int getErrorCode() {
|
||
|
return errorCode;
|
||
|
}
|
||
|
|
||
|
public String getErrorMsg() {
|
||
|
return errorMsg;
|
||
|
}
|
||
|
}
|