Skip to content

Error Handling

Mohamed Osman edited this page Oct 1, 2019 · 4 revisions

Types of Exceptions

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:

AuthenticationException:

Exceptions raised due to failure in the authentication due to invalid credentials, token, etc, either from a PSP endpoint or from a Merchant backend.

ValidationException:

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.

ConfigurationException:

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.

NetworkException:

Exceptions concerning network connectivity are handled separately. This allows the developer to retry automatically if they so wish.

TemporaryException:

Exceptions of temporary nature where retrying the same request (albeit with a different idempotency key) is likely to fix the issue.

OtherException:

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.