-
Notifications
You must be signed in to change notification settings - Fork 0
Error Handling
The SDK currently provides the following types of Exceptions:
AuthenticationException
ValidationException
ConfigurationException
NetworkException
TemporaryException
OtherException
The following will explain each of these types of exceptions and go into how an application might handle those:
Exceptions raised due to failure in the authentication due to invalid credentials, token, etc, either from a PSP endpoint or from a Merchant backend.
These are exceptions concerning the data provided directly by the user. The SDK validates this data on-device to ensure that e.g. credit card numbers, IBANs, and CVVs are of valid formats. If the provided data is not valid, a validation exception is thrown and the user or SDK developer can take care of it.
The SDK configuration created by the user is flawed. This might happen when the given Mobilab Stash! backend endpoint is invalid or if a module is invalidly configured.
Exceptions concerning network connectivity are handled separately. This allows the developer to retry automatically if they so wish.
Exceptions of temporary nature where retrying the same request (albeit with a different idempotency key) is likely to fix the issue.
All other kinds of exceptions that the SDK could not directly map to one of the aforementioned categories.
Many of the exception types also contain payloads that may provide third-party error codes. These stem from either the MobiLab Stash! backend or a given PSP. Using these third-party error codes might couple an application tightly to the used PSP but allows for greater control over how which errors should be handled.