Class HttpException

All Implemented Interfaces:
Serializable

public final class HttpException extends IOException
Thrown when an http request fails.

Exposes the specific status code or UNKNOWN via getStatusCode() so users may attempt to retry or otherwise uniformly handle certain types of errors regardless of the underlying http library.

See Also:
  • Field Details

  • Constructor Details

    • HttpException

      public HttpException(int statusCode)
    • HttpException

      @Deprecated public HttpException(String message)
      Deprecated.
      You should always include a status code, default to UNKNOWN if you can't come up with a reasonable one. This method will be removed in a future version.
    • HttpException

      public HttpException(String message, int statusCode)
    • HttpException

      public HttpException(String message, int statusCode, @Nullable Throwable cause)
  • Method Details

    • getStatusCode

      public int getStatusCode()
      Returns the http status code, or UNKNOWN if the request failed without providing a status code.