AS AgentScopeAPI 手册 / API Reference

HttpTransportException

public class HttpTransportException extends RuntimeException
源码Source io/agentscope/core/model/transport/HttpTransportException.java:24–187

HTTP 传输层异常,表示执行过程中的错误。位于 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.

参数Parameters
名称Name类型Type说明Description
messageString错误消息。the error message
源码Source io/agentscope/core/model/transport/HttpTransportException.java:34–38

HttpTransportException

public HttpTransportException(String message, Throwable cause)

初始化 HttpTransportException 实例。

Create a new HttpTransportException with a message and cause.

参数Parameters
名称Name类型Type说明Description
messageString错误消息。the error message
causeThrowablecause(类型 `Throwable`)。the underlying cause
源码Source io/agentscope/core/model/transport/HttpTransportException.java:46–50

HttpTransportException

public HttpTransportException(String message, int statusCode, String responseBody)

创建新的HttpTransportException 用于 HTTP 错误响应。

Create a new HttpTransportException for an HTTP error response.

参数Parameters
名称Name类型Type说明Description
messageString错误消息。the error message
statusCodeint状态 Code(类型 `int`)。the HTTP status code
responseBodyString响应正文(类型 `String`)。the response body (may contain error details)
源码Source io/agentscope/core/model/transport/HttpTransportException.java:59–63

HttpTransportException

public HttpTransportException(String message, int statusCode, String responseBody, Throwable cause)

初始化 HttpTransportException 实例。

Create a new HttpTransportException for an HTTP error response with cause.

参数Parameters
名称Name类型Type说明Description
messageString错误消息。the error message
statusCodeint状态 Code(类型 `int`)。the HTTP status code
responseBodyString响应正文。the response body
causeThrowablecause(类型 `Throwable`)。the underlying cause
源码Source io/agentscope/core/model/transport/HttpTransportException.java:73–78

方法详情Method Detail

getStatusCode

public Integer getStatusCode()

获取 getStatusCode。

Get the HTTP status code if available.

返回Returns Integer
返回数值结果。the status code, or null if not an HTTP error
源码Source io/agentscope/core/model/transport/HttpTransportException.java:85–87

getResponseBody

public String getResponseBody()

获取响应正文 if 可用。

Get the response body if available.

返回Returns String
返回字符串结果。the response body, or null if not available
源码Source io/agentscope/core/model/transport/HttpTransportException.java:94–96

isHttpError

public boolean isHttpError()

判断是否HTTP 错误。

Check if this is an HTTP error (has status code).

返回Returns boolean
返回布尔值,表示判断结果。true if this exception represents an HTTP error response
源码Source io/agentscope/core/model/transport/HttpTransportException.java:103–105

isClientError

public boolean isClientError()

判断是否客户端错误。

Check if this is a client error (4xx status code).

返回Returns boolean
返回布尔值,表示判断结果。true if status code is 4xx
源码Source io/agentscope/core/model/transport/HttpTransportException.java:112–114

isServerError

public boolean isServerError()

判断是否服务端错误。

Check if this is a server error (5xx status code).

返回Returns boolean
返回布尔值,表示判断结果。true if status code is 5xx
源码Source io/agentscope/core/model/transport/HttpTransportException.java:121–123

isRetryable

public boolean isRetryable()

判断是否 isRetryable。

Check if this error is retryable.

返回Returns boolean
返回布尔值,表示判断结果。true if the error is retryable
源码Source io/agentscope/core/model/transport/HttpTransportException.java:133–140

getMessage

public String getMessage()

获取消息。

Get the detailed error message including response body for better debugging.

返回Returns String
返回字符串结果。the full error message with response body details
源码Source io/agentscope/core/model/transport/HttpTransportException.java:150–162

toString

public String toString()

获取已格式化错误消息使用所有可用详情。

Get the formatted error message with all available details.

返回Returns String
返回字符串结果。formatted error string including status code and response body
源码Source io/agentscope/core/model/transport/HttpTransportException.java:169–186
基于官方固定版本源码静态生成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.