Class HttpClientResponseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.micronaut.http.exceptions.HttpException
io.micronaut.http.client.exceptions.HttpClientException
io.micronaut.http.client.exceptions.HttpClientResponseException
- All Implemented Interfaces:
HttpResponseProvider,Serializable
public class HttpClientResponseException
extends HttpClientException
implements HttpResponseProvider
An exception that occurs when a response returns an error code equal to or greater than 400.
- Since:
- 1.0
- Author:
- Graeme Rocher
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionHttpClientResponseException(String message, HttpResponse<?> response) HttpClientResponseException(String message, Throwable cause, HttpResponse<?> response) HttpClientResponseException(String message, Throwable cause, HttpResponse<?> response, HttpClientErrorDecoder errorDecoder) -
Method Summary
Methods inherited from class io.micronaut.http.client.exceptions.HttpClientException
getServiceId, setServiceIdMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
HttpClientResponseException
- Parameters:
message- The messageresponse- The Http response
-
HttpClientResponseException
- Parameters:
message- The messagecause- The throwableresponse- The Http response
-
HttpClientResponseException
public HttpClientResponseException(String message, Throwable cause, HttpResponse<?> response, HttpClientErrorDecoder errorDecoder) - Parameters:
message- The messagecause- The throwableresponse- The Http responseerrorDecoder- The error decoder
-
-
Method Details
-
getMessage
- Overrides:
getMessagein classHttpClientException
-
getResponse
- Specified by:
getResponsein interfaceHttpResponseProvider- Returns:
- The
HttpResponse
-
getStatus
- Returns:
- The
HttpStatusreturned To support custom status codes. Usecode()instead ofgetStatus()andHttpStatus.getCode()andreason()instead ofgetStatus()andHttpStatus.getReason().
-
code
public int code()- Returns:
- The response status code
-
reason
- Returns:
- The HTTP status reason phrase
-