Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More detailed error description #831

Open
vladminsky opened this issue Oct 19, 2022 · 2 comments
Open

More detailed error description #831

vladminsky opened this issue Oct 19, 2022 · 2 comments

Comments

@vladminsky
Copy link

General information

  • SDK version: "braintree-web-drop-in": "1.33.4"
  • Environment: Both Sandbox and Production
  • Browser and OS: doesn't matter

Issue description

I already came to you with issue braintree/braintree-web#644 and this is a request for better error handling.

There was an error during 3DSecure validation process. I contacted Braintree support and we found out that the user's address (passed to threeDSecure args) exceeds the limit. The original error deeply inside the system was "Billing line1 format is invalid".
While the immediate error said something useless like "Something went wrong during 3D Secure authentication" which forced me to contact you and BT support for more details.

try {
        const payload = await dropInRef.current.requestPaymentMethod({
          threeDSecure: {
            amount: realTotalPriceWithTax,
            email: billingEmail,
            billingAddress: {
              streetAddress: address,  // !!! address string exceeded 50 chars
              locality: locality,
              countryCodeAlpha2: countryCode,
            },
          },
        });
...
} catch (ex) {
        // ex.message is "Something went wrong during 3D Secure authentication."
}

Once I managed to reproduce the issue (with address line more than 50 chars) - I discovered locally that the ex error has much more info under the hood placed in _braintreeWebError property. It contains something like the following:

{
  "originalError": {
    "name": "BraintreeError",
    "code": "CLIENT_REQUEST_ERROR",
    "message": "There was a problem with your request.",
    "type": "NETWORK",
    "details": {
      "originalError": {
        "error": {"message": "Billing line1 format is invalid."},
        "threeDSecureInfo": {"liabilityShifted": false, "liabilityShiftPossible": false},
      }, "httpStatus": 422,
    },
  },
}

The problem is the property is not documented and I have to use it on my own risk to see a bit more about the true underlying error.

So I want to ask you to consider this git issue as a feature request for better (more detailed and well documented) error handling in braintree-web library since current approach to error handling is too superficial and documentation is quite poor on this topic (https://braintree.github.io/braintree-web-drop-in/docs/current/Dropin.html#requestPaymentMethod-examples).

Thank you in advance

@hollabaq86 hollabaq86 transferred this issue from braintree/braintree-web Oct 19, 2022
@hollabaq86
Copy link
Contributor

@vladminsky thanks for reaching out, I agree we can make our error messaging more robust, particularly for 3DS workflows. I don't have an ETA on when this will get added but this is on our radar!

@vladminsky
Copy link
Author

I don't have an ETA on when this will get added but this is on our radar!

Thank you. Will wait then :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants