Closed josemigallas closed 1 year ago
Hi @josemigallas,
If something causes the client creation to error out (such as a malformed authorization string), Hosted Fields will appear to set up just fine, but you will see an unhandled promise rejection in the console and any method calls that rely on the client will fail with that same error.
If we adjusted the code to bubble up the error from the client creation into the creation of Hosted Fields, it would take away all the speed gains of allowing the Hosted Fields inputs to render and be ready for a customer to enter their card details before the client is actually available.
The unhandled error in the console is a known side effect to pushing the underlying client creation to an asynchronous process. We're aware of it, but the times it actually happens in production are fairly rare. You have to do something like 'intentionally mess up the authorization string' to trigger it on demand.
Let me know if you have more questions on this.
If there is more that is required on this ticket, then we can either reopen this back or create a new ticket.
Marking this as closed. Thank you.
General information
Issue description
The following code won't catch the authentication error due to bad client token:
It will instead resolve the promise with the following error in the browser console:
Instantiating the client will catch a BraintreeError as expected so I guess this rejection is lost somewhere.
Is this an already known issue? I may be able to send a PR with a fix, provided this is somehow a feature not a bug 😃.