修改异常处理.

This commit is contained in:
lijiahang
2023-07-25 15:02:15 +08:00
parent f01f696d37
commit ee53ec6486
8 changed files with 49 additions and 54 deletions

View File

@@ -6,7 +6,12 @@ import com.orion.lang.utils.Exceptions;
import com.orion.lang.utils.Strings;
/**
* 错误码
* 用于定义错误码
* <p>
* 1. http 通用 status
* 2. 前端需要特殊处理
* 3. @ExceptionHandler 全局异常
* 其他情况可以定义在 ExceprionMessage 中
*
* @author Jiahang Li
* @version 1.0.0
@@ -15,6 +20,8 @@ import com.orion.lang.utils.Strings;
@SuppressWarnings("ALL")
public enum ErrorCode implements CodeInfo {
// -------------------- http message --------------------
BAD_REQUEST(400, "参数验证失败"),
UNAUTHORIZED(401, "当前认证信息已失效, 请重新登录"),
@@ -27,7 +34,7 @@ public enum ErrorCode implements CodeInfo {
REQUEST_TIMEOUT(408, "处理超时"),
CONFLICT(409, "状态发生改变, 请刷新后重试"),
CONFLICT(409, "数据状态发生改变, 请刷新后重试"),
PAYLOAD_TOO_LARGE(413, "请求过大"),
@@ -45,10 +52,6 @@ public enum ErrorCode implements CodeInfo {
USER_LOCKED(702, "当前用户已被锁定"),
ROLE_PRESENT(703, "角色 [{}] 不存在"),
DATA_ALTER(704, "数据发生改变, 请刷新后重试"),
// -------------------- 自定义 - 通用 --------------------
NETWORK_FLUCTUATION(900, "当前环境网路波动"),

View File

@@ -31,6 +31,8 @@ public interface ErrorMessage {
String ROLE_ABSENT = "角色不存在";
String ROLE_CODE_ABSENT = "角色 [{}] 不存在";
String INVALID_PARENT_MENU = "所选父菜单不合法";
String PARENT_MENU_ABSENT = "父菜单不存在";