AS AgentScopeAPI 手册 / API Reference

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
agentAgent智能体(类型 `Agent`)。The agent instance (must not be null)
errorThrowable错误(类型 `Throwable`)。The error that occurred (must not be null)
抛出Throws
  • 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.

返回Returns Throwable
错误。The error
源码Source io/agentscope/core/hook/ErrorEvent.java:65–67

继承成员Inherited Members

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.