Error Details

This topic provides the SDK error details.

Netspend exposes the following errors.

DecryptFailureWeb SDK is not able to decrypt the provided input.
DeviceDataGenerationFailureMay occur if an Iovation connection failure occurs.
DeviceKeyGenerationFailureWeb SDK is not able to generate its key pairs.
EncryptFailureWeb SDK is not able to encrypt the provided input.
InvalidUserSessionInitializationDataThe user_session_initialization_data provided in web SDK is invalid.
SecureStorageFailureMay occur during operations at a storage level.
UserSessionConnectionFailureMay occur while creating a user session (key exchange process) in web SDK.

Code Samples for Error Catching

Below are the code samples for error catching for Web SDK, Android SDK, and iOS SDK.


try {
	// `user_session_initialization_data` from your server 
	const init = await
	NetspendSDK.session.state // 'initializing'
	// Send `init.deviceData` to your server to create a user session
	// Then, from the response of creating the user session on the server 
	// const response = await fetch('/sessions', { body:init.deviceData }});
	// const sessionData = await response.json();
	// Pass the "encrypted_data" from POST /sessions to 
       // to finish opening the session
	NetspendSDK.session.state // 'ready'
	NetspendSDK.session.sessionId // Session ID, e.g. '3b10acea-e862-4720-91e0-fdd80a13eb28'
	// Now you can use the "encrypt()" and "decrypt()" methods
    // Failure! error.code will contain the above mentioned error codes 
    if(error.code === 'InvalidUserSessionInitializationData') {
        alert('Invalid user session data has been passed to websdk'); 

Android SDK

You can catch fatal errors by overriding onNetspendSdkEncounteredFatalError(errorMessage: String) in your NetspendSdkActivity subclass. The default implementation is to log the message to stderr and then kill the entire application process.

class MyNetspendSdkActivity : NetspendSdkActivity() {
    override fun onNetspendSdkEncounteredFatalError(errorMessage: String) {
        System.err.println("Uh oh. Netspend had a fatal error. We should indicate to the user that all netspend sdk is unavailable.")
        // Finish, to go back to the prior screen because this Activity will *not* work in its current state
        // Defaults to killing your process, which crashes your app
        // android.os.Process.killProcess(android.os.Process.myPid());


You can catch fatal errors by implementing the delegate NetspendSdkViewControllerDelegate.

extension MyNetspendDelegate: NetspendSdkViewControllerDelegate {
    func netspendSdkViewController(_ viewController: NetspendSdkViewController,
        didEncounterFatalError errorMessage: String) {
        print("Uh oh. Netspend had a fatal error. 
          We should indicate to the user that all netspend sdk is unavailable.")
        // Defaults to `fatalError`, which crashes your app
        // fatalError(errorMessage)