HttpTransportException
public class HttpTransportException extends RuntimeException
io/agentscope/core/model/transport/HttpTransportException.java:24–187HTTP 传输层异常,表示执行过程中的错误。位于 io.agentscope.core.model.transport 包,继承自 RuntimeException。核心成员包括 getStatusCode、getResponseBody、isHttpError、isClientError、isServerError、isRetryable。
Exception thrown when HTTP transport operations fail.
This exception wraps underlying transport errors such as connection failures, timeouts, and protocol errors.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public HttpTransportException(String message) | 创建新的HttpTransportException 使用消息。 Create a new HttpTransportException with a message. |
public HttpTransportException(String message, Throwable cause) | 初始化 `HttpTransportException` 实例。 Create a new HttpTransportException with a message and cause. |
public HttpTransportException(String message, int statusCode, String responseBody) | 创建新的HttpTransportException 用于 HTTP 错误响应。 Create a new HttpTransportException for an HTTP error response. |
public HttpTransportException(String message, int statusCode, String responseBody, Throwable cause) | 初始化 `HttpTransportException` 实例。 Create a new HttpTransportException for an HTTP error response with cause. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Integer getStatusCode() | 获取 `getStatusCode`。 Get the HTTP status code if available. |
public String getResponseBody() | 获取响应正文 if 可用。 Get the response body if available. |
public boolean isHttpError() | 判断是否HTTP 错误。 Check if this is an HTTP error (has status code). |
public boolean isClientError() | 判断是否客户端错误。 Check if this is a client error (4xx status code). |
public boolean isServerError() | 判断是否服务端错误。 Check if this is a server error (5xx status code). |
public boolean isRetryable() | 判断是否 `isRetryable`。 Check if this error is retryable. |
public String getMessage() | 获取消息。 Get the detailed error message including response body for better debugging. |
public String toString() | 获取已格式化错误消息使用所有可用详情。 Get the formatted error message with all available details. |
构造器详情Constructor Detail
HttpTransportException
public HttpTransportException(String message)
创建新的HttpTransportException 使用消息。
Create a new HttpTransportException with a message.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
message | String | 错误消息。the error message |
io/agentscope/core/model/transport/HttpTransportException.java:34–38HttpTransportException
public HttpTransportException(String message, Throwable cause)
初始化 HttpTransportException 实例。
Create a new HttpTransportException with a message and cause.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
message | String | 错误消息。the error message |
cause | Throwable | cause(类型 `Throwable`)。the underlying cause |
io/agentscope/core/model/transport/HttpTransportException.java:46–50HttpTransportException
public HttpTransportException(String message, int statusCode, String responseBody)
创建新的HttpTransportException 用于 HTTP 错误响应。
Create a new HttpTransportException for an HTTP error response.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
message | String | 错误消息。the error message |
statusCode | int | 状态 Code(类型 `int`)。the HTTP status code |
responseBody | String | 响应正文(类型 `String`)。the response body (may contain error details) |
io/agentscope/core/model/transport/HttpTransportException.java:59–63HttpTransportException
public HttpTransportException(String message, int statusCode, String responseBody, Throwable cause)
初始化 HttpTransportException 实例。
Create a new HttpTransportException for an HTTP error response with cause.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
message | String | 错误消息。the error message |
statusCode | int | 状态 Code(类型 `int`)。the HTTP status code |
responseBody | String | 响应正文。the response body |
cause | Throwable | cause(类型 `Throwable`)。the underlying cause |
io/agentscope/core/model/transport/HttpTransportException.java:73–78方法详情Method Detail
getStatusCode
public Integer getStatusCode()
获取 getStatusCode。
Get the HTTP status code if available.
Integerio/agentscope/core/model/transport/HttpTransportException.java:85–87getResponseBody
public String getResponseBody()
获取响应正文 if 可用。
Get the response body if available.
Stringio/agentscope/core/model/transport/HttpTransportException.java:94–96isHttpError
public boolean isHttpError()
判断是否HTTP 错误。
Check if this is an HTTP error (has status code).
booleanio/agentscope/core/model/transport/HttpTransportException.java:103–105isClientError
public boolean isClientError()
判断是否客户端错误。
Check if this is a client error (4xx status code).
booleanio/agentscope/core/model/transport/HttpTransportException.java:112–114isServerError
public boolean isServerError()
判断是否服务端错误。
Check if this is a server error (5xx status code).
booleanio/agentscope/core/model/transport/HttpTransportException.java:121–123isRetryable
public boolean isRetryable()
判断是否 isRetryable。
Check if this error is retryable.
booleanio/agentscope/core/model/transport/HttpTransportException.java:133–140getMessage
public String getMessage()
获取消息。
Get the detailed error message including response body for better debugging.
Stringio/agentscope/core/model/transport/HttpTransportException.java:150–162toString
public String toString()
获取已格式化错误消息使用所有可用详情。
Get the formatted error message with all available details.
Stringio/agentscope/core/model/transport/HttpTransportException.java:169–186