Enum Class EventErrorCode

java.lang.Object
java.lang.Enum<EventErrorCode>
cloud.opencode.base.event.exception.EventErrorCode
All Implemented Interfaces:
Serializable, Comparable<EventErrorCode>, Constable

public enum EventErrorCode extends Enum<EventErrorCode>
Event Error Code Enumeration 事件错误码枚举

Defines all error codes for event operations.

定义所有事件操作的错误码。

Error Code Ranges | 错误码范围:

  • 0 - Unknown error - 未知错误
  • 1xxx - Publish errors - 发布错误
  • 2xxx - Listener errors - 监听器错误
  • 3xxx - Store errors - 存储错误
  • 4xxx - Security errors - 安全错误

Features | 主要功能:

  • Categorized error codes - 分类错误码
  • Bilingual descriptions - 双语描述

Usage Examples | 使用示例:

EventErrorCode code = EventErrorCode.LISTENER_ERROR;
System.out.println(code.getCode() + ": " + code.getDescription());

Security | 安全性:

  • Thread-safe: Yes (immutable) - 线程安全: 是(不可变)
Since:
JDK 25, opencode-base-event V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Enum Constant Details

    • UNKNOWN

      public static final EventErrorCode UNKNOWN
      Unknown error - 未知错误
    • PUBLISH_FAILED

      public static final EventErrorCode PUBLISH_FAILED
      Publish failed - 发布失败
    • EVENT_CANCELLED

      public static final EventErrorCode EVENT_CANCELLED
      Event cancelled - 事件被取消
    • TIMEOUT

      public static final EventErrorCode TIMEOUT
      Timeout - 超时
    • LISTENER_ERROR

      public static final EventErrorCode LISTENER_ERROR
      Listener error - 监听器错误
    • REGISTRATION_FAILED

      public static final EventErrorCode REGISTRATION_FAILED
      Registration failed - 注册失败
    • DUPLICATE_LISTENER

      public static final EventErrorCode DUPLICATE_LISTENER
      Duplicate listener - 重复注册
    • INVALID_LISTENER_METHOD

      public static final EventErrorCode INVALID_LISTENER_METHOD
      Invalid listener method - 无效的监听器方法
    • STORE_ERROR

      public static final EventErrorCode STORE_ERROR
      Store error - 存储错误
    • PERSIST_FAILED

      public static final EventErrorCode PERSIST_FAILED
      Persist failed - 持久化失败
    • REPLAY_FAILED

      public static final EventErrorCode REPLAY_FAILED
      Replay failed - 重放失败
    • VERIFICATION_FAILED

      public static final EventErrorCode VERIFICATION_FAILED
      Verification failed - 验证失败
    • RATE_LIMITED

      public static final EventErrorCode RATE_LIMITED
      Rate limited - 频率超限
    • SECURITY_VIOLATION

      public static final EventErrorCode SECURITY_VIOLATION
      Security violation - 安全违规
  • Method Details

    • values

      public static EventErrorCode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static EventErrorCode valueOf(String name)
      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.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getCode

      public int getCode()
      Get error code number 获取错误码数字
      Returns:
      the error code | 错误码
    • getDescription

      public String getDescription()
      Get error description in English 获取英文错误描述
      Returns:
      the description | 描述
    • getDescriptionCn

      public String getDescriptionCn()
      Get error description in Chinese 获取中文错误描述
      Returns:
      the description in Chinese | 中文描述
    • fromException

      public static EventErrorCode fromException(Throwable e)
      Get error code from exception 从异常获取错误码
      Parameters:
      e - the exception | 异常
      Returns:
      the error code | 错误码