AS AgentScopeAPI 手册 / API Reference

ApiException

public class ApiException extends ResponseStatusException
源码Source io/agentscope/builder/web/api/error/ApiException.java:22–103

API 异常,表示执行过程中的错误。位于 io.agentscope.builder.web.api.error 包,继承自 ResponseStatusException。核心成员包括 errorType、code、param、sessionId、toDetail、invalidRequest。

Typed API failure with stable machine code for HTTP and session.error payloads.

构造器摘要Constructor Summary

构造器Constructor说明Description
public ApiException(ApiErrorType errorType, String code, String message)
初始化 `ApiException` 实例。
Creates a new instance.
public ApiException(ApiErrorType errorType, String code, String message, String param, String sessionId)
初始化 `ApiException` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public ApiErrorType errorType()
返回错误类型。
Returns the error type.
public String code()
返回 `code` 结果。
Returns the code.
public String param()
返回参数。
Returns the param.
public String sessionId()
返回会话标识。
Returns the session id.
public ApiErrorDetail toDetail()
返回到详情。
Returns the to detail.
public static ApiException invalidRequest(String code, String message)
static
执行无效请求相关操作。
Performs the invalid request operation.
public static ApiException invalidRequest(String code, String message, String param)
static
执行无效请求相关操作。
Performs the invalid request operation.
public static ApiException notFound(String code, String message)
static
执行未找到相关操作。
Performs the not found operation.
public static ApiException conflict(String code, String message)
static
执行 `conflict` 方法。
Performs the conflict operation.
public static ApiException permission(String code, String message)
static
执行权限相关操作。
Performs the permission operation.
public static ApiException authentication(String code, String message)
static
执行 `authentication` 方法。
Performs the authentication operation.
public static ApiException api(String code, String message)
static
执行API相关操作。
Performs the api operation.
public static ApiErrorDetail detailFrom(ResponseStatusException ex)
static
设置详情来自。
Best-effort wrap of a bare `ResponseStatusException`.

构造器详情Constructor Detail

ApiException

public ApiException(ApiErrorType errorType, String code, String message)

初始化 ApiException 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
errorTypeApiErrorType错误类型(类型 `ApiErrorType`)。The error type.
codeStringcode(类型 `String`)。The code.
messageString消息(类型 `String`)。The message.
源码Source io/agentscope/builder/web/api/error/ApiException.java:29–31

ApiException

public ApiException(ApiErrorType errorType, String code, String message, String param, String sessionId)

初始化 ApiException 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
errorTypeApiErrorType错误类型(类型 `ApiErrorType`)。The error type.
codeStringcode(类型 `String`)。The code.
messageString消息(类型 `String`)。The message.
paramString参数(类型 `String`)。The param.
sessionIdString会话标识(类型 `String`)。The session id.
源码Source io/agentscope/builder/web/api/error/ApiException.java:33–40

方法详情Method Detail

errorType

public ApiErrorType errorType()

返回错误类型。

Returns the error type.

返回Returns ApiErrorType
返回ApiErrorType。Returns api error type.
源码Source io/agentscope/builder/web/api/error/ApiException.java:42–44

code

public String code()

返回 code 结果。

Returns the code.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/builder/web/api/error/ApiException.java:46–48

param

public String param()

返回参数。

Returns the param.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/builder/web/api/error/ApiException.java:50–52

sessionId

public String sessionId()

返回会话标识。

Returns the session id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/builder/web/api/error/ApiException.java:54–56

toDetail

public ApiErrorDetail toDetail()

返回到详情。

Returns the to detail.

返回Returns ApiErrorDetail
返回ApiErrorDetail。Returns api error detail.
源码Source io/agentscope/builder/web/api/error/ApiException.java:58–60

invalidRequest

public static ApiException invalidRequest(String code, String message)
static

执行无效请求相关操作。

Performs the invalid request operation.

参数Parameters
名称Name类型Type说明Description
codeStringcode(类型 `String`)。The code.
messageString消息(类型 `String`)。The message.
返回Returns ApiException
返回ApiException。Returns api exception.
源码Source io/agentscope/builder/web/api/error/ApiException.java:62–64

invalidRequest

public static ApiException invalidRequest(String code, String message, String param)
static

执行无效请求相关操作。

Performs the invalid request operation.

参数Parameters
名称Name类型Type说明Description
codeStringcode(类型 `String`)。The code.
messageString消息(类型 `String`)。The message.
paramString参数(类型 `String`)。The param.
返回Returns ApiException
返回ApiException。Returns api exception.
源码Source io/agentscope/builder/web/api/error/ApiException.java:66–68

notFound

public static ApiException notFound(String code, String message)
static

执行未找到相关操作。

Performs the not found operation.

参数Parameters
名称Name类型Type说明Description
codeStringcode(类型 `String`)。The code.
messageString消息(类型 `String`)。The message.
返回Returns ApiException
返回ApiException。Returns api exception.
源码Source io/agentscope/builder/web/api/error/ApiException.java:70–72

conflict

public static ApiException conflict(String code, String message)
static

执行 conflict 方法。

Performs the conflict operation.

参数Parameters
名称Name类型Type说明Description
codeStringcode(类型 `String`)。The code.
messageString消息(类型 `String`)。The message.
返回Returns ApiException
返回ApiException。Returns api exception.
源码Source io/agentscope/builder/web/api/error/ApiException.java:74–76

permission

public static ApiException permission(String code, String message)
static

执行权限相关操作。

Performs the permission operation.

参数Parameters
名称Name类型Type说明Description
codeStringcode(类型 `String`)。The code.
messageString消息(类型 `String`)。The message.
返回Returns ApiException
返回ApiException。Returns api exception.
源码Source io/agentscope/builder/web/api/error/ApiException.java:78–80

authentication

public static ApiException authentication(String code, String message)
static

执行 authentication 方法。

Performs the authentication operation.

参数Parameters
名称Name类型Type说明Description
codeStringcode(类型 `String`)。The code.
messageString消息(类型 `String`)。The message.
返回Returns ApiException
返回ApiException。Returns api exception.
源码Source io/agentscope/builder/web/api/error/ApiException.java:82–84

api

public static ApiException api(String code, String message)
static

执行API相关操作。

Performs the api operation.

参数Parameters
名称Name类型Type说明Description
codeStringcode(类型 `String`)。The code.
messageString消息(类型 `String`)。The message.
返回Returns ApiException
返回ApiException。Returns api exception.
源码Source io/agentscope/builder/web/api/error/ApiException.java:86–88

detailFrom

public static ApiErrorDetail detailFrom(ResponseStatusException ex)
static

设置详情来自。

Best-effort wrap of a bare ResponseStatusException.

参数Parameters
名称Name类型Type说明Description
exResponseStatusExceptionex(类型 `ResponseStatusException`)。The ex.
返回Returns ApiErrorDetail
返回ApiErrorDetail。Returns api error detail.
源码Source io/agentscope/builder/web/api/error/ApiException.java:91–102
基于官方固定版本源码静态生成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.