你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
HttpResponseException Class
- java.
lang. Object - java.
lang. Throwable - java.
lang. Exception - java.
lang. RuntimeException - com.
azure. core. exception. AzureException - com.
azure. core. exception. HttpResponseException
- com.
- com.
- java.
- java.
- java.
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 Http |
HttpResponseException(HttpResponse response, Throwable cause) |
Initializes a new instance of the Http |
HttpResponseException(String message, HttpResponse response) |
Initializes a new instance of the Http |
HttpResponseException(String message, HttpResponse response, Object value) |
Initializes a new instance of the Http |
HttpResponseException(String message, HttpResponse response, Throwable cause) |
Initializes a new instance of the Http |
HttpResponseException(String message, HttpResponse response, Throwable cause, boolean enableSuppression, boolean writableStackTrace) |
Initializes a new instance of the Http |
Method Summary
Modifier and Type | Method and Description |
---|---|
Http |
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:
HttpResponseException
public HttpResponseException(HttpResponse response, Throwable cause)
Initializes a new instance of the HttpResponseException class.
Parameters:
HttpResponseException
public HttpResponseException(String message, HttpResponse response)
Initializes a new instance of the HttpResponseException class.
Parameters:
HttpResponseException
public HttpResponseException(String message, HttpResponse response, Object value)
Initializes a new instance of the HttpResponseException class.
Parameters:
HttpResponseException
public HttpResponseException(String message, HttpResponse response, Throwable cause)
Initializes a new instance of the HttpResponseException class.
Parameters:
HttpResponseException
public HttpResponseException(String message, HttpResponse response, Throwable cause, boolean enableSuppression, boolean writableStackTrace)
Initializes a new instance of the HttpResponseException class.
Parameters:
Method Details
getResponse
public HttpResponse getResponse()
Gets the HttpResponse received that is associated to the exception.
Returns:
getValue
public Object getValue()
Gets the deserialized HTTP response value.
Returns: