Class StreamHttpErrorException

All Implemented Interfaces:
Serializable

public class StreamHttpErrorException extends StreamException
An exception indicating that the remote server returned an HTTP error.

HttpConnectStrategy defines an error as any non-2xx status.

See StreamException for more about EventSource's exception behavior.

Since:
4.0.0
See Also:
  • Constructor Details

    • StreamHttpErrorException

      public StreamHttpErrorException(int code)
      Constructs an instance.
      Parameters:
      code - the HTTP status
    • StreamHttpErrorException

      public StreamHttpErrorException(int code, ResponseHeaders headers)
      Constructs an instance with response headers.
      Parameters:
      code - the HTTP status
      headers - the response headers, or null if not available
      Since:
      4.2.0
  • Method Details

    • getCode

      public int getCode()
      Returns the HTTP status code.
      Returns:
      the HTTP status
    • getHeaders

      public ResponseHeaders getHeaders()
      Returns the response headers from the failed HTTP request, or null if not available.
      Returns:
      the response headers, or null
      Since:
      4.2.0