Enhance logging of Stripe ApiErrorExceptions in ErrorHelper

Created on 14 January 2022, almost 3 years ago
Updated 5 October 2023, about 1 year ago

Problem/Motivation

Stripe's ApiErrorException provides useful error codes (and their CardException provides decline codes). Currently Commerce Stripe's ErrorHelper both fails to log this information and makes it unavailable to custom debugging or logging code.

Proposed resolution

1. Append the result of ApiErrorException::getStripeCode() and CardException::getDeclineCode() to the message logged to the site log.
2. When ErrorHelper throws new exceptions in place of Stripe's ApiErrorExceptions, provide the original ApiErrorException as the "previous" parameter to the new exceptions. This makes it available to custom code catching the thrown exception, by calling $exception->getPrevious().

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom jonathanshaw Stroud, UK

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024