RestExceptionHandler
@RestControllerAdvice public class RestExceptionHandler
源码Source
io/agentscope/builder/web/api/error/RestExceptionHandler.java:28–65REST 异常处理器,承载智能体的部署、调度与服务化运行。位于 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 |
|---|---|---|
ex | ApiException | ex(类型 `ApiException`)。The ex. |
ResponseEntity<ApiErrorResponse>返回ResponseEntity。Returns response entity.
源码Source
io/agentscope/builder/web/api/error/RestExceptionHandler.java:33–36handleStatus
public ResponseEntity<ApiErrorResponse> handleStatus(ResponseStatusException ex)
处理状态。
Performs the handle status operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ex | ResponseStatusException | ex(类型 `ResponseStatusException`)。The ex. |
ResponseEntity<ApiErrorResponse>返回ResponseEntity。Returns response entity.
源码Source
io/agentscope/builder/web/api/error/RestExceptionHandler.java:38–42handleInput
public ResponseEntity<ApiErrorResponse> handleInput(ServerWebInputException ex)
处理输入。
Performs the handle input operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ex | ServerWebInputException | ex(类型 `ServerWebInputException`)。The ex. |
ResponseEntity<ApiErrorResponse>返回ResponseEntity。Returns response entity.
源码Source
io/agentscope/builder/web/api/error/RestExceptionHandler.java:44–52handleOther
public ResponseEntity<ApiErrorResponse> handleOther(Exception ex)
处理 handleOther。
Performs the handle other operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ex | Exception | ex(类型 `Exception`)。The ex. |
ResponseEntity<ApiErrorResponse>返回ResponseEntity。Returns response entity.
源码Source
io/agentscope/builder/web/api/error/RestExceptionHandler.java:54–64