org.apache.hc.client5.http

## Class HttpResponseException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.io.IOException
      - - org.apache.hc.client5.http.ClientProtocolException
        - - org.apache.hc.client5.http.HttpResponseException

All Implemented Interfaces:
  Serializable

    public class HttpResponseException
    extends ClientProtocolException

Signals a non 2xx HTTP response.

Since:
  4.0
See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`HttpResponseException(int statusCode, String reasonPhrase)` Constructs a new instance of `HttpResponseException` with the given status code and reason phrase, and no content bytes or content type.
`HttpResponseException(int statusCode, String reasonPhrase, byte[] contentBytes, ContentType contentType)` Constructs a new instance of `HttpResponseException` with the given status code, reason phrase, content bytes, and content type.

### Method Summary

All Methods Instance Methods Concrete Methods
`byte[]` `getContentBytes()`
`ContentType` `getContentType()`
`String` `getReasonPhrase()`
`int` `getStatusCode()`

### Methods inherited from class java.lang.Throwable

`addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### HttpResponseException

    public HttpResponseException(int statusCode,
                                 String reasonPhrase)

Constructs a new instance of `HttpResponseException` with the given status code and reason phrase, and no content bytes or content type.

Parameters:
  `statusCode` - the HTTP status code
  `reasonPhrase` - the reason phrase associated with the HTTP status code

#### HttpResponseException

    public HttpResponseException(int statusCode,
                                 String reasonPhrase,
                                 byte[] contentBytes,
                                 ContentType contentType)

Constructs a new instance of `HttpResponseException` with the given status code, reason phrase, content bytes, and content type.

Parameters:
  `statusCode` - the HTTP status code
  `reasonPhrase` - the reason phrase associated with the HTTP status code
  `contentBytes` - the content bytes of the HTTP response
  `contentType` - the content type of the HTTP response

### Method Detail

#### getStatusCode

    public int getStatusCode()

#### getReasonPhrase

    public String getReasonPhrase()

#### getContentBytes

    public byte[] getContentBytes()

#### getContentType

    public ContentType getContentType()