Package com.azure.core.exception
Class HttpResponseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.azure.core.exception.AzureException
com.azure.core.exception.HttpResponseException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ClientAuthenticationException,DecodeException,ResourceExistsException,ResourceModifiedException,ResourceNotFoundException,TooManyRedirectsException
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.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionHttpResponseException(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 TypeMethodDescriptionGets theHttpResponsereceived that is associated to the exception.getValue()Gets the deserialized HTTP response value.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
HttpResponseException
Initializes a new instance of the HttpResponseException class.- Parameters:
response- TheHttpResponsereceived that is associated to the exception.
-
HttpResponseException
Initializes a new instance of the HttpResponseException class.- Parameters:
message- The exception message.response- TheHttpResponsereceived that is associated to the exception.
-
HttpResponseException
Initializes a new instance of the HttpResponseException class.- Parameters:
response- TheHttpResponsereceived that is associated to the exception.cause- TheThrowablewhich caused the creation of this exception.
-
HttpResponseException
Initializes a new instance of the HttpResponseException class.- Parameters:
message- The exception message.response- TheHttpResponsereceived that is associated to the exception.value- The deserialized response value.
-
HttpResponseException
Initializes a new instance of the HttpResponseException class.- Parameters:
message- The exception message.response- TheHttpResponsereceived that is associated to the exception.cause- TheThrowablewhich 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- TheHttpResponsereceived that is associated to the exception.cause- TheThrowablewhich 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
Gets theHttpResponsereceived that is associated to the exception.- Returns:
- The
HttpResponsereceived that is associated to the exception.
-
getValue
Gets the deserialized HTTP response value.- Returns:
- The deserialized HTTP response value.
-