Error Handling
Required
Needed by every integration.
Some SDK endpoints and observers can fail from time to time due to a variety of reasons. Endpoints that take a completion handler function as a parameter will have both a success and failure closures. Most SDK observers will also have an onError function. All SDK errors are reported as IPSError.
IPSError is a protocol with the following properties:
message
var message: String
The description of the error.
code
var code: IPSErrorCodes
The enum indication of the type of error which occurred.
recoveryStrategy
var recoveryStrategy: IPSErrorRecoveryStrategy
The enum indication of the type of recovery strategy after receiving an error.
IPSError Recovery Strategies
Starting from SDK v4.0.0 we simplified the error handling and eliminated the need to handle each error code separately. We added a recoveryStrategy object that indicates how the error should be handled.
These are the possible values for IPSErrorRecoveryStrategy, and for which IPSError code it could be received:
login
case login = 0
Errors with recoveryStrategy == .login, indicating that the user isn't authenticated and login wasn't performed successfully. You will need to login before retrying the requested operation.
retry
case retry = 1
Errors with recoveryStrategy == .retry, are errors where if operation will be retried, there is a good likelihood it will eventually succeed, such as if the client had limited internet connectivity.
unrecoverable
case unrecoverable = 2
Errors with recoveryStrategy == .unrecoverable, are errors that shouldn't be retried, as the operation will fail over and over if retried. For example if the device's sensors are not sufficient for the operation, or the device sensors are malfunctioning.