ErrorCode.java
637 Bytes
package com.xly.constant;
import lombok.Getter;
/** 异常码枚举(供 {@code GlobalExceptionHandler} 统一错误响应用)。 */
@Getter
public enum ErrorCode {
BAD_REQUEST(400, "请求参数错误"),
NOT_FOUND(404, "资源不存在"),
PARAM_ERROR(40001, "参数错误"),
DATA_ERROR(50002, "数据异常"),
DATA_EXISTS(50004, "数据已存在"),
SYSTEM_ERROR(10000, "系统异常"),
DB_ERROR(10002, "数据库异常");
private final Integer code;
private final String message;
ErrorCode(Integer code, String message) {
this.code = code;
this.message = message;
}
}