Enum Class ErrorCode
- 所有已实现的接口:
BaseEnum,Serializable,Comparable<ErrorCode>,java.lang.constant.Constable
错误代码枚举
定义标准化的错误代码,包含错误描述和分类信息,支持国际化错误消息
- 作者:
- isliu
-
嵌套类概要
嵌套类从类继承的嵌套类/接口 java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
枚举常量概要
枚举常量枚举常量说明 -
方法概要
修饰符和类型方法说明static ErrorCode[]getByCategory(ErrorCode.ErrorCategory category) 根据分类获取所有错误代码static ErrorCode根据错误代码获取枚举值获取错误分类getCode()获取错误代码获取默认错误消息getDesc()获取默认描述getFormattedMessage(Object... args) 获取当前语言环境的格式化错误消息getFormattedMessage(Locale locale, Object... args) 获取格式化的错误消息获取当前语言环境的错误消息getMessage(Locale locale) 获取国际化错误消息boolean检查是否为客户端错误booleanisFatal()检查是否为致命错误boolean检查是否为可重试的错误boolean检查是否为服务器错误static ErrorCodeReturns the enum constant of this class with the specified name.static ErrorCode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
枚举常量详细资料
-
CLIENT_NOT_INITIALIZED
-
CLIENT_INITIALIZATION_FAILED
-
CLIENT_CONNECTION_FAILED
-
CLIENT_AUTHENTICATION_FAILED
-
CLIENT_TIMEOUT
-
API_CALL_FAILED
-
API_RATE_LIMIT_EXCEEDED
-
API_INVALID_REQUEST
-
API_UNAUTHORIZED
-
API_FORBIDDEN
-
API_NOT_FOUND
-
API_SERVER_ERROR
-
API_RESPONSE_PARSE_ERROR
-
THREAD_SAFETY_VIOLATION
-
CONCURRENT_MODIFICATION
-
DEADLOCK_DETECTED
-
RACE_CONDITION
-
CONFIGURATION_ERROR
-
INVALID_CONFIGURATION
-
CONFIGURATION_NOT_FOUND
-
CONFIGURATION_PARSE_ERROR
-
CONFIGURATION_VALIDATION_FAILED
-
RESOURCE_EXHAUSTED
-
MEMORY_INSUFFICIENT
-
CONNECTION_POOL_EXHAUSTED
-
FILE_NOT_FOUND
-
FILE_ACCESS_DENIED
-
DISK_SPACE_INSUFFICIENT
-
DATA_VALIDATION_FAILED
-
DATA_CONVERSION_ERROR
-
DATA_INTEGRITY_VIOLATION
-
DATA_FORMAT_ERROR
-
DATA_SIZE_EXCEEDED
-
SECURITY_VIOLATION
-
INVALID_CREDENTIALS
-
ACCESS_DENIED
-
TOKEN_EXPIRED
-
ENCRYPTION_FAILED
-
DECRYPTION_FAILED
-
TOKEN_MANAGEMENT_ERROR
-
TOKEN_FETCH_FAILED
-
TOKEN_PARSE_ERROR
-
TOKEN_CACHE_ERROR
-
TOKEN_REFRESH_FAILED
-
BUSINESS_LOGIC_ERROR
-
INVALID_OPERATION
-
OPERATION_NOT_SUPPORTED
-
PRECONDITION_FAILED
-
WORKFLOW_ERROR
-
SYSTEM_ERROR
-
SERVICE_UNAVAILABLE
-
MAINTENANCE_MODE
-
VERSION_INCOMPATIBLE
-
UNKNOWN_ERROR
-
-
方法详细资料
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- 返回:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- 参数:
name- 要返回的枚举常量的名称。- 返回:
- 返回带有指定名称的枚举常量
- 抛出:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- 如果参数为空值
-
getCode
获取错误代码 -
getDesc
获取默认描述 -
getCategory
获取错误分类- 返回:
- 错误分类
-
getDefaultMessage
获取默认错误消息- 返回:
- 默认错误消息
-
getMessage
获取国际化错误消息- 参数:
locale- 语言环境- 返回:
- 国际化错误消息
-
getMessage
获取当前语言环境的错误消息- 返回:
- 当前语言环境的错误消息
-
getFormattedMessage
获取格式化的错误消息- 参数:
locale- 语言环境args- 格式化参数- 返回:
- 格式化的错误消息
-
getFormattedMessage
获取当前语言环境的格式化错误消息- 参数:
args- 格式化参数- 返回:
- 格式化的错误消息
-
getByCode
根据错误代码获取枚举值- 参数:
code- 错误代码- 返回:
- 对应的枚举值,未找到返回UNKNOWN_ERROR
-
getByCategory
根据分类获取所有错误代码- 参数:
category- 错误分类- 返回:
- 该分类下的所有错误代码
-
isClientError
public boolean isClientError()检查是否为客户端错误- 返回:
- 如果是客户端错误返回true
-
isServerError
public boolean isServerError()检查是否为服务器错误- 返回:
- 如果是服务器错误返回true
-
isRetryable
public boolean isRetryable()检查是否为可重试的错误- 返回:
- 如果是可重试的错误返回true
-
isFatal
public boolean isFatal()检查是否为致命错误- 返回:
- 如果是致命错误返回true
-