SensibillError
Summary
This class provides error codes for consistent error handling across SDK.
Error codes are available in swift in format SensibillError.errorCode
, and in Objective C in format SensibillErrorErrorCode
.
Additionally, errors can be constructed from Error
, NSError
, and/or HTTP status code.
Error names and values are selected to provide a clue to error origin, severity, and cause:
Details
Error Origin
Error prefix identifies origin of the errors:
- Errors received from API are prefixed with
api
and correspond to API error types. For exampleapiBadRequest
corresponds to API error typeBadRequestError
. - Errors thrown by SDK are prefixed with
sdk
. - Errors prefixed with
fdn
originate from Foundation and other native libraries used by an application.
Error Severity
Error code provides a way to identify errors that cannot be resolved by SDK integrator, and require assistance from Sensibill team.
- When there’s no error,
0
is returned (corresponds toSensibillError.none
) - Errors below 0 indicate high severity server-side issues that require assistance from Sensibill team
- Errors above 0 indicate normal severity issues, which can be handled by integrating app.
Error Cause
The name of the error (kincluding origin prefix) provide a clue to error reason.
Error Logging
To further improve troubleshooting, error is logged in detail using os_log
on default
level.
-
0 - Success
-
-500 - Internal server error. Please contact Sensibill team if encountered.
-
1 - SDK was not able to recognize the error.
-
2 - Status code of HTTP response could not be interpreted as success or failure and no error was returned.
-
3 - A general error with domain NSURLError.
-
1000 - Not entitled to access an object (user, receipt, merchant or client) based on current access token
-
1001 - User is not authorized
-
1002 - Invalid credentials provided
-
1003 - The password is temporary, and will be authorized when reset by the user
-
1004 - Authorization Grant Failure
-
1010 - Too many failed login attempts
-
1011 - Incorrect email/password combination
-
1012 - Missing parameter in authentication request (email/password, or accessID/accessSecret/credentialType)
-
1013 - Authentication error, e.g. authentication required, or cancelled by a client
-
1014 - Logout failed
-
1015 - User details are missing
-
1016 - Missing User Credentials
-
1020 - Access Token Retrieval Failure
-
1021 - Client Token Retrieval Failure
-
1022 - Received response could not be parsed as token
-
1023 - Refresh token is missing
-
1024 - Request failed with error 401, even after token was successfully refreshed. May indicate that token provider returns invalid token.
-
1030 - Request omitted a required parameter, or invalid value was provided for a required parameter.
-
1031 - One or more invalid parameters were passed in the request
-
1032 - One or more parameters were missing in the request
-
1033 - Extra parameter in request, or attempt to modify read-only parameter
-
1034 - Request body is missing
-
1035 - Validation failed on added/modified entiity. Check parameter values (e.g. incorrectly formatted dates)
-
1036 - Requested entity was not found
-
1037 - Conflicting values provided. For example if there is already an email account with the provided email address
-
1038 - Logout request returned an error
-
1040 - Response was not returned or could not be understood
-
1041 - Response could not be parsed as UserAPIModel
-
1042 - Response could not be parsed as PasswordEvaluation
-
1043 - Response from one of the Availability endpoints could not be parsed
-
1044 - Response could not be parsed as SupportedCurrenciesAPIModel
-
1045 - Response could not be parsed as ReceiptAPIModel
-
1046 - Response could not be parsed as ReceiptAPIModel
-
1047 - No data returned in response
-
1048 - Sensibill API Client task execution error. See log for the cause of the error.
-
1049 - Cannot parse response data as expected model. See log for the cause of the error.
-
1050 - Configuration provided in Sensibill.plist is invalid. Verify log for more information
-
1051 - Sensibill.plist file was not found. Verify log for more information
-
1052 - The contents of Sensibill.plist could not be read or parsed.
-
1053 - SDK configuration is missing one or more values
-
1054 - Some of the certificate files, specified in Sensibill.plist were not found
-
1055 - SDK configuration is missing Credential Type
-
1056 - Current context is missing cache identifier
-
1057 - SDK failed to refresh folder collection for current user
-
1058 - User is missing in current context
-
1059 - TokenProvider object of SDK instance is not set
-
1060 - Request was cancelled
-
1061 - Request timed out
-
1062 - Cannot connect to server (e.g. DNS resolution, or routing issue)
-
1063 - Network connection error (e.g. not connected to internet)
-
1064 - SSL error, e.g. certificate issues
-
1065 - Application is trying to access a wrong URL
-
1066 - An error occurred while validating sserver certificate pinning. See log for more information.
-
1080 - Start cannot be called at this time. SDK is already starting, running, or stopping. Wait for completion or call
stop
to interrupt and restart. -
1081 - Start of SDK was interrupted by a user-initiated
stop
-
1082 - SDK is already stopping. Wait for completion.
-
1083 - SDK must be started to perform a requested operation.