Skip to content

Commit

Permalink
Merge pull request #325 from kiva/catch-tracking-data-errors
Browse files Browse the repository at this point in the history
fix: catch errors that may occur during transaction tracking data fetch
  • Loading branch information
emuvente authored Dec 5, 2023
2 parents 4c0fb7a + 3bfb805 commit 63a4af4
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 63a4af4

Please sign in to comment.