类 HttpTransportException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.agentscope.core.model.transport.HttpTransportException
所有已实现的接口:
Serializable

public class HttpTransportException extends RuntimeException
Exception thrown when HTTP transport operations fail.

This exception wraps underlying transport errors such as connection failures, timeouts, and protocol errors.

另请参阅:
  • 构造器详细资料

    • HttpTransportException

      public HttpTransportException(String message)
      Create a new HttpTransportException with a message.
      参数:
      message - the error message
    • HttpTransportException

      public HttpTransportException(String message, Throwable cause)
      Create a new HttpTransportException with a message and cause.
      参数:
      message - the error message
      cause - the underlying cause
    • HttpTransportException

      public HttpTransportException(String message, int statusCode, String responseBody)
      Create a new HttpTransportException for an HTTP error response.
      参数:
      message - the error message
      statusCode - the HTTP status code
      responseBody - the response body (may contain error details)
    • HttpTransportException

      public HttpTransportException(String message, int statusCode, String responseBody, Throwable cause)
      Create a new HttpTransportException for an HTTP error response with cause.
      参数:
      message - the error message
      statusCode - the HTTP status code
      responseBody - the response body
      cause - the underlying cause
  • 方法详细资料

    • getStatusCode

      public Integer getStatusCode()
      Get the HTTP status code if available.
      返回:
      the status code, or null if not an HTTP error
    • getResponseBody

      public String getResponseBody()
      Get the response body if available.
      返回:
      the response body, or null if not available
    • isHttpError

      public boolean isHttpError()
      Check if this is an HTTP error (has status code).
      返回:
      true if this exception represents an HTTP error response
    • isClientError

      public boolean isClientError()
      Check if this is a client error (4xx status code).
      返回:
      true if status code is 4xx
    • isServerError

      public boolean isServerError()
      Check if this is a server error (5xx status code).
      返回:
      true if status code is 5xx
    • isRetryable

      public boolean isRetryable()
      Check if this error is retryable.

      Server errors (5xx) and certain client errors (429 Too Many Requests) are typically retryable.

      返回:
      true if the error is retryable
    • getMessage

      public String getMessage()
      Get the detailed error message including response body for better debugging.

      If a response body is available, it will be appended to the message for easier troubleshooting.

      覆盖:
      getMessage 在类中 Throwable
      返回:
      the full error message with response body details
    • toString

      public String toString()
      Get the formatted error message with all available details.
      覆盖:
      toString 在类中 Throwable
      返回:
      formatted error string including status code and response body