Error handling

According to the EMVCo 3DS SDK Specification, the Netcetera iOS 3DS SDK throws the following error types:

Exception Description
Invalid input This error is caused by invalidity of input provided to the 3DS SDK. It will contain message describing the cause.
SDK Already Initialized This error is caused when initializing a ThreeDS2Service instance that has been already initialized.
SDK Not Initialized This error is caused when calling ThreeDS2Service method on an instance that has not yet been initialized.
SDK runtime error This error is thrown when an error occurs internally in the Netcetera iOS 3DS SDK. It contains a message describing the cause and error code that provides better understanding of the cause of the error.

Netcetera 3DS SDK Error codes

Because the SDK supports both Swift and Objective-C, integration the errors that are thrown from the 3DS SDK are NSError objects. They all contain an error code and localized description with the error message. The error codes for all of the above mentioned errors are:

Exception Error Code Domain
Invalid input 1000 com.netcetera.ThreeDS-SDK
SDK Already Initialized 1001 com.netcetera.ThreeDS-SDK
SDK Not Initialized 1002 com.netcetera.ThreeDS-SDK
SDK runtime error 1003 com.netcetera.ThreeDS-SDK

All errors belong to the same domain. The type of the error is defined with the error code.

The SDK runtime error which is thrown if an internal error is encountered by the 3DS SDK contains additional localized failure reason message. This message contains an error code which provides additional information of the reason for the error. The error values can be retrieved from the NSError properties.

NSError property
domain The error domain
code The error code
localizedDescription The error message
localizedFailureReason Internal failure reason error code (SDKRuntime error only)