ErrorEvent
@Deprecated(forRemoval = true, since = "2.0.0") public final class ErrorEvent extends HookEvent
源码Source
io/agentscope/core/hook/ErrorEvent.java:43–68错误事件,描述执行过程中的事件。位于 io.agentscope.core.hook 包,继承自 HookEvent。核心成员包括 getError、ErrorEvent。
Event fired when an error occurs during agent execution.
Modifiable: No (notification-only)
Context:
-
#getAgent()- The agent instance -
#getMemory()- Agent's memory -
#getError()- The error that occurred
Use Cases:
-
Log errors with context
-
Send error notifications
-
Collect error metrics
-
Implement custom error handling
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public ErrorEvent(Agent agent, Throwable error) | 初始化 `ErrorEvent` 实例。 Constructor for ErrorEvent. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Throwable getError() | 获取错误。 Get the error that occurred. |
构造器详情Constructor Detail
ErrorEvent
public ErrorEvent(Agent agent, Throwable error)
初始化 ErrorEvent 实例。
Constructor for ErrorEvent.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agent | Agent | 智能体(类型 `Agent`)。The agent instance (must not be null) |
error | Throwable | 错误(类型 `Throwable`)。The error that occurred (must not be null) |
NullPointerException可能抛出 `NullPointerException`。if agent or error is null
源码Source
io/agentscope/core/hook/ErrorEvent.java:55–58方法详情Method Detail
getError
public Throwable getError()
获取错误。
Get the error that occurred.
Throwable错误。The error
源码Source
io/agentscope/core/hook/ErrorEvent.java:65–67