Ingenico-ePayments / connect-sdk-client-js

Ingenico Connect JavaScript Client SDK
https://docs.connect.worldline-solutions.com/documentation/sdk/mobile/javascript/
Other
26 stars 15 forks source link

errors are not propagated to the calling function #13

Closed winfinit closed 4 years ago

winfinit commented 4 years ago

Error is not being propagating to the calling function and "UNKNOWN" errors are impossible to act on. We have a use case where user might have an expired session and in order for us to "act" on this, we need to get some indicator in the application that call is being rejected due to "some" access issue. You can find below an abstract sample, showing that there is nothing useful that is coming back in the error response.

We've created a non intrusive inclusion of error, allowing our client to access error response and act upon in.

PR: https://github.com/Ingenico-ePayments/connect-sdk-client-js/pull/12


        const connectSession = new connectsdk.Session(
            session.sessionToken.token
        );

        try {
           const iinDetails = await connectSession.getIinDetails(
                creditCard.number,
                paymentDetails
            );
        } catch (e) {
           // nothing useful in this error response
        }
rob-spoor commented 4 years ago

This should be fixed in release 3.18.0.