plusone-commons 修改了 BaseException

This commit is contained in:
2023-09-09 18:19:58 +08:00
parent b870684fea
commit 208d7c93c9
10 changed files with 55 additions and 55 deletions

View File

@@ -11,29 +11,29 @@ public class BizException extends BaseException {
@java.io.Serial
private static final long serialVersionUID = -5524759033245815405L;
public static final int DEFAULT_ERROR_CODE = 4000000;
public static final String DEFAULT_ERROR_CODE = "4000000";
public BizException(int code, String msg) {
public BizException(String code, String msg) {
super(code, msg);
}
public BizException(int code, Throwable cause) {
public BizException(String code, Throwable cause) {
super(code, cause);
}
public BizException(int code, String msg, Throwable cause) {
public BizException(String code, String msg, Throwable cause) {
super(code, msg, cause);
}
public BizException(String msg) {
super(DEFAULT_ERROR_CODE, msg);
public static BizException of(String msg) {
return new BizException(DEFAULT_ERROR_CODE, msg);
}
public BizException(Throwable cause) {
super(DEFAULT_ERROR_CODE, cause);
public static BizException of(Throwable cause) {
return new BizException(DEFAULT_ERROR_CODE, cause);
}
public BizException(String msg, Throwable cause) {
super(DEFAULT_ERROR_CODE, msg, cause);
public static BizException of(String msg, Throwable cause) {
return new BizException(DEFAULT_ERROR_CODE, msg, cause);
}
}

View File

@@ -14,7 +14,7 @@ public class DataNotExistException extends BizException {
@java.io.Serial
private static final long serialVersionUID = 6536955800679703111L;
public static final int ERROR_CODE = 4110100;
public static final String ERROR_CODE = "4110100";
public DataNotExistException() {
super(ERROR_CODE, "数据不存在");

View File

@@ -18,7 +18,7 @@ public class DataOperationResultException extends SysException {
@java.io.Serial
private static final long serialVersionUID = -9220765735990318186L;
public static final int ERROR_CODE = 4110200;
public static final String ERROR_CODE = "4110200";
public DataOperationResultException() {
super(ERROR_CODE, "数据操作结果不符合预期");

View File

@@ -6,29 +6,29 @@ public class SysException extends BaseException {
@java.io.Serial
private static final long serialVersionUID = 8821240827443168118L;
public static final int DEFAULT_ERROR_CODE = 5000000;
public static final String DEFAULT_ERROR_CODE = "5000000";
public SysException(int code, String msg) {
public SysException(String code, String msg) {
super(code, msg);
}
public SysException(int code, Throwable cause) {
public SysException(String code, Throwable cause) {
super(code, cause);
}
public SysException(int code, String msg, Throwable cause) {
public SysException(String code, String msg, Throwable cause) {
super(code, msg, cause);
}
public SysException(String msg) {
super(DEFAULT_ERROR_CODE, msg);
public static SysException of(String msg) {
return new SysException(DEFAULT_ERROR_CODE, msg);
}
public SysException(Throwable cause) {
super(DEFAULT_ERROR_CODE, cause);
public static SysException of(Throwable cause) {
return new SysException(DEFAULT_ERROR_CODE, cause);
}
public SysException(String msg, Throwable cause) {
super(DEFAULT_ERROR_CODE, msg, cause);
public static SysException of(String msg, Throwable cause) {
return new SysException(DEFAULT_ERROR_CODE, msg, cause);
}
}

View File

@@ -14,28 +14,28 @@ public class UserOperationException extends BizException {
@java.io.Serial
private static final long serialVersionUID = 4371055414421991940L;
public static final int DEFAULT_ERROR_CODE = 4040600;
public static final String DEFAULT_ERROR_CODE = "4040600";
public UserOperationException(String msg) {
super(DEFAULT_ERROR_CODE, msg);
}
public UserOperationException(String msg, Throwable cause) {
super(DEFAULT_ERROR_CODE, msg, cause);
}
public UserOperationException(int code, String msg) {
public UserOperationException(String code, String msg) {
super(code, msg);
}
public UserOperationException(int code, Throwable cause) {
public UserOperationException(String code, Throwable cause) {
super(code, cause);
}
public UserOperationException(int code, String msg, Throwable cause) {
public UserOperationException(String code, String msg, Throwable cause) {
super(code, msg, cause);
}
public static UserOperationException of(String msg) {
return new UserOperationException(DEFAULT_ERROR_CODE, msg);
}
public static UserOperationException of(String msg, Throwable cause) {
return new UserOperationException(DEFAULT_ERROR_CODE, msg, cause);
}
/**
* 无效的操作
*
@@ -52,7 +52,7 @@ public class UserOperationException extends BizException {
* @return 异常对象
*/
public static UserOperationException invalidOperation(String msg) {
return new UserOperationException(4040604, msg);
return new UserOperationException("4040604", msg);
}
}

View File

@@ -186,7 +186,7 @@ public class FastDFSUtil {
var sha512Hex = new BigInteger(1, result).toString(16);
return Objects.requireNonNull(sha512Hex);
} catch (NoSuchAlgorithmException e) {
throw new SysException(e);
throw SysException.of(e);
}
}
}