Package com.onfido.exceptions
Class ApiException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.onfido.exceptions.OnfidoException
-
- com.onfido.exceptions.ApiException
-
- All Implemented Interfaces:
Serializable
public final class ApiException extends OnfidoException
Wrapper class for the error response returned from the Onfido API.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ApiExceptionfromResponseBody(String body, int statusCode)Extracts an exception from the response body.Map<String,Object>getFields()Gets fields.StringgetMessage()intgetStatusCode()Gets status code.StringgetType()Gets type.booleanisClientError()Is client error boolean.-
Methods inherited from class com.onfido.exceptions.OnfidoException
networkError
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Method Detail
-
fromResponseBody
public static ApiException fromResponseBody(String body, int statusCode)
Extracts an exception from the response body.- Parameters:
body- the bodystatusCode- the status code- Returns:
- the api exception
-
getMessage
public String getMessage()
- Overrides:
getMessagein classThrowable
-
getStatusCode
public int getStatusCode()
Gets status code.- Returns:
- the status code
-
isClientError
public boolean isClientError()
Is client error boolean.- Returns:
- the boolean
-
getType
public String getType()
Gets type.- Returns:
- the type
-
-