Skip to content

Commit

Permalink
Merge pull request #5435 from kiva/fix-abiguous-braintree-error-repor…
Browse files Browse the repository at this point in the history
…ting

fix: fallback to UNKNOWN_ERROR_CODE and stringified response for unpa…
  • Loading branch information
mcstover committed Aug 7, 2024
2 parents 0f61c19 + 7fc0686 commit a6778b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugins/braintree-dropin-error-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export default {
methods: {
processBraintreeDropInError(trackCategory, kivaBraintreeResponse) {
// eslint-disable-next-line max-len
const errorCode = kivaBraintreeResponse.errors?.[0]?.extensions?.code || kivaBraintreeResponse.errors?.[0]?.error;
const errorMessage = kivaBraintreeResponse.errors?.[0]?.message;
const errorCode = kivaBraintreeResponse.errors?.[0]?.extensions?.code ?? kivaBraintreeResponse.errors?.[0]?.error ?? 'UNKNOWN_ERROR_CODE';
const errorMessage = kivaBraintreeResponse.errors?.[0]?.message ?? JSON.stringify(kivaBraintreeResponse);
// eslint-disable-next-line max-len
const standardError = 'There was an error processing your payment. Please confirm your payment details and try again or contact our support team at <a href="mailto:contactus@kiva.org">contactus@kiva.org</a>.';

Expand Down

0 comments on commit a6778b2

Please sign in to comment.