I'm trying to call the stripe API within an async method on the server (javascript, using MeteorJS) like so:
selectedPlan = await Stripe.plans.retrieve(stripePlanId);
the stripe API call (using the NodeJS library) has a callback to handle the error, but what syntax could I use to capture the error, if I'm using the await pattern?
tried something like
[error, selectedPlan] = await Stripe.plans.retrieve(stripePlanId);
but that did not work.
It should be like this:
try {
selectedPlan = await Stripe.plans.retrieve(stripePlanId);
} catch (error) {
// error handling
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With