ApiException
public class ApiException extends ResponseStatusException
io/agentscope/builder/web/api/error/ApiException.java:22–103API 异常,表示执行过程中的错误。位于 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
构造器详情Constructor Detail
ApiException
public ApiException(ApiErrorType errorType, String code, String message)
初始化 ApiException 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
errorType | ApiErrorType | 错误类型(类型 `ApiErrorType`)。The error type. |
code | String | code(类型 `String`)。The code. |
message | String | 消息(类型 `String`)。The message. |
io/agentscope/builder/web/api/error/ApiException.java:29–31ApiException
public ApiException(ApiErrorType errorType, String code, String message, String param, String sessionId)
初始化 ApiException 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
errorType | ApiErrorType | 错误类型(类型 `ApiErrorType`)。The error type. |
code | String | code(类型 `String`)。The code. |
message | String | 消息(类型 `String`)。The message. |
param | String | 参数(类型 `String`)。The param. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
io/agentscope/builder/web/api/error/ApiException.java:33–40方法详情Method Detail
errorType
public ApiErrorType errorType()
返回错误类型。
Returns the error type.
ApiErrorTypeio/agentscope/builder/web/api/error/ApiException.java:42–44code
public String code()
返回 code 结果。
Returns the code.
Stringio/agentscope/builder/web/api/error/ApiException.java:46–48param
public String param()
返回参数。
Returns the param.
Stringio/agentscope/builder/web/api/error/ApiException.java:50–52sessionId
public String sessionId()
返回会话标识。
Returns the session id.
Stringio/agentscope/builder/web/api/error/ApiException.java:54–56toDetail
public ApiErrorDetail toDetail()
返回到详情。
Returns the to detail.
ApiErrorDetailio/agentscope/builder/web/api/error/ApiException.java:58–60invalidRequest
public static ApiException invalidRequest(String code, String message)
执行无效请求相关操作。
Performs the invalid request operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
code | String | code(类型 `String`)。The code. |
message | String | 消息(类型 `String`)。The message. |
ApiExceptionio/agentscope/builder/web/api/error/ApiException.java:62–64invalidRequest
public static ApiException invalidRequest(String code, String message, String param)
执行无效请求相关操作。
Performs the invalid request operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
code | String | code(类型 `String`)。The code. |
message | String | 消息(类型 `String`)。The message. |
param | String | 参数(类型 `String`)。The param. |
ApiExceptionio/agentscope/builder/web/api/error/ApiException.java:66–68notFound
public static ApiException notFound(String code, String message)
执行未找到相关操作。
Performs the not found operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
code | String | code(类型 `String`)。The code. |
message | String | 消息(类型 `String`)。The message. |
ApiExceptionio/agentscope/builder/web/api/error/ApiException.java:70–72conflict
public static ApiException conflict(String code, String message)
执行 conflict 方法。
Performs the conflict operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
code | String | code(类型 `String`)。The code. |
message | String | 消息(类型 `String`)。The message. |
ApiExceptionio/agentscope/builder/web/api/error/ApiException.java:74–76permission
public static ApiException permission(String code, String message)
执行权限相关操作。
Performs the permission operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
code | String | code(类型 `String`)。The code. |
message | String | 消息(类型 `String`)。The message. |
ApiExceptionio/agentscope/builder/web/api/error/ApiException.java:78–80authentication
public static ApiException authentication(String code, String message)
执行 authentication 方法。
Performs the authentication operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
code | String | code(类型 `String`)。The code. |
message | String | 消息(类型 `String`)。The message. |
ApiExceptionio/agentscope/builder/web/api/error/ApiException.java:82–84api
public static ApiException api(String code, String message)
执行API相关操作。
Performs the api operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
code | String | code(类型 `String`)。The code. |
message | String | 消息(类型 `String`)。The message. |
ApiExceptionio/agentscope/builder/web/api/error/ApiException.java:86–88detailFrom
public static ApiErrorDetail detailFrom(ResponseStatusException ex)
设置详情来自。
Best-effort wrap of a bare ResponseStatusException.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ex | ResponseStatusException | ex(类型 `ResponseStatusException`)。The ex. |
ApiErrorDetailio/agentscope/builder/web/api/error/ApiException.java:91–102