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.
Issue fork commerce_stripe-3258663
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
jonathanshawI've also removed an
elseif ($exception instance of ApiErrorException)that is unnecessary because the function isgnature guarantees that the supplied $exception is an ApiErrorException.Comment #4
jonathanshawComment #5
shabana.navas commentedPatch looks good and working. Though, we might need tests for this.
Comment #6
chandeepkhosa commentedI can also confirm that the patches continue to apply smoothly for 1.0-rc10 & 1.0. It would be really great if we could look at getting this merging in soon :)
Comment #7
simgui8 commentedI have been using this for months, still applies on today dev release.
Thanks @jonathanshaw
Comment #10
rszrama commentedI honestly have no clue what a merge train is or why GitLab always thinks I want one. This has been merged. 😅