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 example apiBadRequest corresponds to API error type BadRequestError.
  • 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 to SensibillError.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.

No Error

Server-Side Errors

General errors with no additional details.

Authorization Errors

Authentication Errors

Token Errors

Request Errors

Response Errors

SDK Configuration

Network Errors

SDK State Errors

  • 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.