다음을 통해 공유


HttpResponseException Class

public class HttpResponseException
extends AzureException

The HttpResponseException represents an exception thrown when an unsuccessful HTTP response is received from a service request.

This exception is typically thrown when the service responds with a non-success status code (e.g., 3XX, 4XX, 5XX).

This class also provides methods to get the HttpResponse that was received when the exception occurred and the deserialized HTTP response value.

Constructor Summary

Constructor Description
HttpResponseException(HttpResponse response)

Initializes a new instance of the HttpResponseException class.

HttpResponseException(HttpResponse response, Throwable cause)

Initializes a new instance of the HttpResponseException class.

HttpResponseException(String message, HttpResponse response)

Initializes a new instance of the HttpResponseException class.

HttpResponseException(String message, HttpResponse response, Object value)

Initializes a new instance of the HttpResponseException class.

HttpResponseException(String message, HttpResponse response, Throwable cause)

Initializes a new instance of the HttpResponseException class.

HttpResponseException(String message, HttpResponse response, Throwable cause, boolean enableSuppression, boolean writableStackTrace)

Initializes a new instance of the HttpResponseException class.

Method Summary

Modifier and Type Method and Description
HttpResponse getResponse()

Gets the HttpResponse received that is associated to the exception.

Object getValue()

Gets the deserialized HTTP response value.

Methods inherited from java.lang.Object

Methods inherited from java.lang.Throwable

Constructor Details

HttpResponseException

public HttpResponseException(HttpResponse response)

Initializes a new instance of the HttpResponseException class.

Parameters:

response - The HttpResponse received that is associated to the exception.

HttpResponseException

public HttpResponseException(HttpResponse response, Throwable cause)

Initializes a new instance of the HttpResponseException class.

Parameters:

response - The HttpResponse received that is associated to the exception.
cause - The Throwable which caused the creation of this exception.

HttpResponseException

public HttpResponseException(String message, HttpResponse response)

Initializes a new instance of the HttpResponseException class.

Parameters:

message - The exception message.
response - The HttpResponse received that is associated to the exception.

HttpResponseException

public HttpResponseException(String message, HttpResponse response, Object value)

Initializes a new instance of the HttpResponseException class.

Parameters:

message - The exception message.
response - The HttpResponse received that is associated to the exception.
value - The deserialized response value.

HttpResponseException

public HttpResponseException(String message, HttpResponse response, Throwable cause)

Initializes a new instance of the HttpResponseException class.

Parameters:

message - The exception message.
response - The HttpResponse received that is associated to the exception.
cause - The Throwable which caused the creation of this exception.

HttpResponseException

public HttpResponseException(String message, HttpResponse response, Throwable cause, boolean enableSuppression, boolean writableStackTrace)

Initializes a new instance of the HttpResponseException class.

Parameters:

message - The exception message.
response - The HttpResponse received that is associated to the exception.
cause - The Throwable which caused the creation of this exception.
enableSuppression - Whether suppression is enabled or disabled.
writableStackTrace - Whether the exception stack trace will be filled in.

Method Details

getResponse

public HttpResponse getResponse()

Gets the HttpResponse received that is associated to the exception.

Returns:

The HttpResponse received that is associated to the exception.

getValue

public Object getValue()

Gets the deserialized HTTP response value.

Returns:

The deserialized HTTP response value.

Applies to