Skip to content

Commit

Permalink
fix: catch errors that may occur during transaction tracking data fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
emuvente committed Dec 4, 2023
1 parent 54effa4 commit 3bfb805
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions @kiva/kv-shop/src/oneTimeCheckout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,24 @@ async function trackSuccess(
checkoutId: string,
paymentType: string,
) {
// get transaction data
const transactionData = await getCheckoutTrackingData(
apollo,
checkoutId,
paymentType,
);
try {
// get transaction data
const transactionData = await getCheckoutTrackingData(
apollo,
checkoutId,
paymentType,
);

// track transaction
trackTransaction(transactionData);
// track transaction
trackTransaction(transactionData);

// wait long enough for tracking to complete
await wait(800);
// wait long enough for tracking to complete
await wait(800);
} catch (e) {
// eslint-disable-next-line no-console
console.error('Error tracking transaction', e);
// TODO: send error to sentry
}
}

export interface OneTimeCheckoutOptions {
Expand Down

0 comments on commit 3bfb805

Please sign in to comment.