Class EventException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.core.exception.OpenException
cloud.opencode.base.event.exception.EventException
- All Implemented Interfaces:
OpenExceptionMeta, Serializable
- Direct Known Subclasses:
EventListenerException, EventPublishException, EventSecurityException, EventStoreException
Event Exception Base Class
事件异常基类
Base exception class for all event-related errors, extending OpenException
to participate in the unified OpenCode exception hierarchy.
所有事件相关错误的基类异常,继承 OpenException 以参与 OpenCode 统一异常体系。
Features | 主要功能:
- Error code support (EventErrorCode) - 错误码支持
- Event context preservation - 事件上下文保留
- Inherits OpenException component/errorCode formatting - 继承 OpenException 组件/错误码格式
Usage Examples | 使用示例:
try {
OpenEvent.getDefault().publish(event);
} catch (EventException e) {
log.error("Event error: code={}, message={}",
e.getEventErrorCode().getCode(), e.getMessage());
}
Security | 安全性:
- Thread-safe: No - 线程安全: 否
- Since:
- JDK 25, opencode-base-event V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEventException(String message) Create exception with message only 仅使用消息创建异常EventException(String message, EventErrorCode errorCode) Create exception with message and error code 使用消息和错误码创建异常EventException(String message, Throwable cause) Create exception with message and cause 使用消息和原因创建异常EventException(String message, Throwable cause, Event event, EventErrorCode errorCode) Create exception with all parameters 使用所有参数创建异常 -
Method Summary
Modifier and TypeMethodDescriptiongetEvent()Get the related event (if available) 获取相关事件(如果可用)Get the event error code 获取事件错误码Methods inherited from class OpenException
getComponent, getErrorCode, getMessage, getRawMessageMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface OpenExceptionMeta
getMetaPrefix
-
Constructor Details
-
EventException
Create exception with message only 仅使用消息创建异常- Parameters:
message- the error message | 错误消息
-
EventException
-
EventException
Create exception with message and error code 使用消息和错误码创建异常- Parameters:
message- the error message | 错误消息errorCode- the error code | 错误码
-
EventException
Create exception with all parameters 使用所有参数创建异常- Parameters:
message- the error message | 错误消息cause- the cause | 原因event- the related event | 相关事件errorCode- the error code | 错误码
-
-
Method Details
-
getEventErrorCode
Get the event error code 获取事件错误码- Returns:
- the event error code | 事件错误码
-
getEvent
Get the related event (if available) 获取相关事件(如果可用)- Returns:
- the event or null | 事件或null
-