My code contains a function:
buy() {
return new Promise((resolve, reject) => {
this.http.request('http://192.168.1.131:8888/generatetoken.php')
.subscribe(res => {
resolve(res.text());
});
}).then((key) => {
braintree.dropin.create({
authorization: key,
container: '#dropin-container'
}, (createErr, instance) => {
if (createErr) {
// An error in the create call is likely due to
// incorrect configuration values or network issues.
// An appropriate error will be shown in the UI.
console.error(createErr + " createErrrrrrrrrrrrrrrrrr");
return;
}
instance.requestPaymentMethod((requestPaymentMethodErr, payload) => {
if (requestPaymentMethodErr) {
// No payment method is available.
// An appropriate error will be shown in the UI.
console.error(requestPaymentMethodErr + " reqqe");
return;
}
// Submit payload.nonce to your server
});
});
}).catch(error => console.log(error + " eoe"));
}
Upon execution, it returns:
console.error: ERROR [object Object]
I'm struggling to figure out where I should catch this error. Currently, I have my error handling after the then()
, but I can't identify any other potential catch points. Any guidance on this issue would be greatly appreciated. Thanks.