plusone-commons 修改了 BaseException
This commit is contained in:
@@ -10,13 +10,13 @@ public class AccountLoginException extends BizException {
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -3040996790739138556L;
|
||||
|
||||
private static final int DEFAULT_ERR_CODE = 4030000;
|
||||
private static final String DEFAULT_ERR_CODE = "4030000";
|
||||
|
||||
private AccountLoginException() {
|
||||
super(DEFAULT_ERR_CODE, "用户登录异常");
|
||||
}
|
||||
|
||||
private AccountLoginException(int code, String message) {
|
||||
private AccountLoginException(String code, String message) {
|
||||
super(code, message);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class AccountLoginException extends BizException {
|
||||
}
|
||||
|
||||
public static AccountLoginException accountNotExistException(String msg) {
|
||||
return new AccountLoginException(4030101, msg);
|
||||
return new AccountLoginException("4030101", msg);
|
||||
}
|
||||
|
||||
public static AccountLoginException otpErrorException() {
|
||||
@@ -33,7 +33,7 @@ public class AccountLoginException extends BizException {
|
||||
}
|
||||
|
||||
public static AccountLoginException otpErrorException(String msg) {
|
||||
return new AccountLoginException(4030501, msg);
|
||||
return new AccountLoginException("4030501", msg);
|
||||
}
|
||||
|
||||
public static AccountLoginException otpNotExistsException() {
|
||||
@@ -41,7 +41,7 @@ public class AccountLoginException extends BizException {
|
||||
}
|
||||
|
||||
public static AccountLoginException otpNotExistsException(String msg) {
|
||||
return new AccountLoginException(4030502, msg);
|
||||
return new AccountLoginException("4030502", msg);
|
||||
}
|
||||
|
||||
public static AccountLoginException passwordErrorException() {
|
||||
@@ -49,6 +49,6 @@ public class AccountLoginException extends BizException {
|
||||
}
|
||||
|
||||
public static AccountLoginException passwordErrorException(String msg) {
|
||||
return new AccountLoginException(4030200, msg);
|
||||
return new AccountLoginException("4030200", msg);
|
||||
}
|
||||
}
|
||||
|
@@ -12,46 +12,46 @@ public class AccountRegisterException extends BizException {
|
||||
private static final long serialVersionUID = 7580245181633370195L;
|
||||
|
||||
public AccountRegisterException() {
|
||||
this(4020000, "用户注册错误");
|
||||
this("4020000", "用户注册错误");
|
||||
}
|
||||
|
||||
public AccountRegisterException(String message) {
|
||||
this(4020000, message);
|
||||
this("4020000", message);
|
||||
}
|
||||
|
||||
public AccountRegisterException(Throwable cause) {
|
||||
super(4020000, cause);
|
||||
super("4020000", cause);
|
||||
}
|
||||
|
||||
public AccountRegisterException(int code, String message) {
|
||||
public AccountRegisterException(String code, String message) {
|
||||
super(code, message);
|
||||
}
|
||||
|
||||
public AccountRegisterException(int code, Throwable cause) {
|
||||
public AccountRegisterException(String code, Throwable cause) {
|
||||
super(code, cause);
|
||||
}
|
||||
|
||||
public static AccountRegisterException emailOrMobilePhoneRequiredException() {
|
||||
return new AccountRegisterException(4020300, "邮箱和手机号应至少绑定一个");
|
||||
return new AccountRegisterException("4020300", "邮箱和手机号应至少绑定一个");
|
||||
}
|
||||
|
||||
public static AccountRegisterException usernameAlreadyExists(String username) {
|
||||
return new AccountRegisterException(4020400, String.format("用户名 %s 已存在", username));
|
||||
return new AccountRegisterException("4020400", String.format("用户名 %s 已存在", username));
|
||||
}
|
||||
|
||||
public static AccountRegisterException emailAlreadyExists(String value) {
|
||||
return new AccountRegisterException(4020500, String.format("邮箱 %s 已存在", value));
|
||||
return new AccountRegisterException("4020500", String.format("邮箱 %s 已存在", value));
|
||||
}
|
||||
|
||||
public static AccountRegisterException mobilePhoneAlreadyExists(String value) {
|
||||
return new AccountRegisterException(4020600, String.format("手机号 %s 已存在", value));
|
||||
return new AccountRegisterException("4020600", String.format("手机号 %s 已存在", value));
|
||||
}
|
||||
|
||||
public static AccountRegisterException codeErrorException() {
|
||||
return new AccountRegisterException(4020701, "校验码错误");
|
||||
return new AccountRegisterException("4020701", "校验码错误");
|
||||
}
|
||||
|
||||
public static AccountRegisterException codeNotExistsException() {
|
||||
return new AccountRegisterException(4020702, "校验码不存在或已过期");
|
||||
return new AccountRegisterException("4020702", "校验码不存在或已过期");
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@ public class UnsupportedPrincipalTypeException extends BizException {
|
||||
|
||||
private static final long serialVersionUID = 5207757290868470762L;
|
||||
|
||||
public static final int ERR_CODE = 4040201;
|
||||
public static final String ERR_CODE = "4040201";
|
||||
private static final String DEFAULT_ERROR_MSG = "不支持的 PrincipalType";
|
||||
|
||||
public UnsupportedPrincipalTypeException() {
|
||||
|
@@ -59,7 +59,7 @@ public class AuthenticationInfo<T> {
|
||||
if (this.metadata.containsKey(key)) {
|
||||
return this.metadata.get(key);
|
||||
}
|
||||
throw new BizException(String.format("不存在 key 为 \"%s\"的元数据。", key));
|
||||
throw BizException.of(String.format("不存在 key 为 \"%s\"的元数据。", key));
|
||||
}
|
||||
|
||||
public OptionalDouble getMetadataAsDouble(String key) {
|
||||
|
Reference in New Issue
Block a user