java.lang.Object
java.lang.Throwable
java.lang.Exception
net.commuty.parking.http.ApiException
net.commuty.parking.http.HttpRequestException
- All Implemented Interfaces:
java.io.Serializable
public class HttpRequestException extends ApiException
This exception will occur when the api accepted the request but returned a HTTP status 400 or above.
You can get the HTTP status code via getHttpResponseCode(). Some helpers methods are present to handle some cases:
isForbidden(): http status 403isUnauthorized(): http status 401isBadRequest(): http status 400
Sometimes, you will get more information via the getErrorResponse() method. This exposes a reason and message property. For more information, consult the api documentation.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Modifier Constructor Description protectedHttpRequestException(int httpResponseCode, Error errorResponse) -
Method Summary
Modifier and Type Method Description ErrorgetErrorResponse()Returns more information linked with the request exception.intgetHttpResponseCode()Returns the http status code.booleanisBadRequest()Indicates if the request is a bad request (http 400).booleanisForbidden()Indicates if the request is forbidden (http 403).booleanisUnauthorized()Indicates if the request is unauthorized (http 401).
-
Constructor Details
-
Method Details
-
getErrorResponse
Returns more information linked with the request exception. Can be null. -
isForbidden
public boolean isForbidden()Indicates if the request is forbidden (http 403). -
isUnauthorized
public boolean isUnauthorized()Indicates if the request is unauthorized (http 401). -
isBadRequest
public boolean isBadRequest()Indicates if the request is a bad request (http 400). -
getHttpResponseCode
public int getHttpResponseCode()Returns the http status code.
-