AS AgentScopeAPI 手册 / API Reference

RestExceptionHandler

@RestControllerAdvice public class RestExceptionHandler
源码Source io/agentscope/builder/web/api/error/RestExceptionHandler.java:28–65

REST 异常处理器,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.api.error 包。核心成员包括 handleApi、handleStatus、handleInput、handleOther。

Maps exceptions on /api/** to the shared typed error envelope.

方法摘要Method Summary

方法Method说明Description
public ResponseEntity<ApiErrorResponse> handleApi(ApiException ex)
处理API。
Performs the handle api operation.
public ResponseEntity<ApiErrorResponse> handleStatus(ResponseStatusException ex)
处理状态。
Performs the handle status operation.
public ResponseEntity<ApiErrorResponse> handleInput(ServerWebInputException ex)
处理输入。
Performs the handle input operation.
public ResponseEntity<ApiErrorResponse> handleOther(Exception ex)
处理 `handleOther`。
Performs the handle other operation.

方法详情Method Detail

handleApi

public ResponseEntity<ApiErrorResponse> handleApi(ApiException ex)

处理API。

Performs the handle api operation.

参数Parameters
名称Name类型Type说明Description
exApiExceptionex(类型 `ApiException`)。The ex.
返回Returns ResponseEntity<ApiErrorResponse>
返回ResponseEntity。Returns response entity.
源码Source io/agentscope/builder/web/api/error/RestExceptionHandler.java:33–36

handleStatus

public ResponseEntity<ApiErrorResponse> handleStatus(ResponseStatusException ex)

处理状态。

Performs the handle status operation.

参数Parameters
名称Name类型Type说明Description
exResponseStatusExceptionex(类型 `ResponseStatusException`)。The ex.
返回Returns ResponseEntity<ApiErrorResponse>
返回ResponseEntity。Returns response entity.
源码Source io/agentscope/builder/web/api/error/RestExceptionHandler.java:38–42

handleInput

public ResponseEntity<ApiErrorResponse> handleInput(ServerWebInputException ex)

处理输入。

Performs the handle input operation.

参数Parameters
名称Name类型Type说明Description
exServerWebInputExceptionex(类型 `ServerWebInputException`)。The ex.
返回Returns ResponseEntity<ApiErrorResponse>
返回ResponseEntity。Returns response entity.
源码Source io/agentscope/builder/web/api/error/RestExceptionHandler.java:44–52

handleOther

public ResponseEntity<ApiErrorResponse> handleOther(Exception ex)

处理 handleOther。

Performs the handle other operation.

参数Parameters
名称Name类型Type说明Description
exExceptionex(类型 `Exception`)。The ex.
返回Returns ResponseEntity<ApiErrorResponse>
返回ResponseEntity。Returns response entity.
源码Source io/agentscope/builder/web/api/error/RestExceptionHandler.java:54–64
基于官方固定版本源码静态生成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.