-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a more detailed error object to the consumer #398
Comments
Thanks for the idea. For example, what about passing an exception object to call.reject, I feel it's not a good design to handle errors with resolve.
Would this solve your problem? |
@rdlabo Ah, I didn't realize call.reject is overloaded. I assumed it only takes a string "message". |
I'm mainly looking to get the decline code that is listed in this table when something fails The failure can happen either on Collect Payment Method, or on Confirm Payment Intent If the failure occurs during Collect Payment Method, If the failure occurs during Confirm Payment Intent, The reason why I'm after this code is because my product team wants to use custom error message based on certain decline codes from that table above and present the user with up to 2 follow up actions. For now I've just ended up extracting the correct code and sending it in the message field of call.reject, I'd rather work towards something that can fit well with the capacitor-community implementation so that I don't have to maintain a fork. |
https://github.com/ionic-team/capacitor/blob/74c3e9447e1e32e73f818d252eb12f453d849e8d/core/src/util.ts#L30C21-L30C34 |
@rdlabo Bingo, yeah that works, thanks for pointing me in the right direction. Guess it would be great to add |
@shiv19 Good!! Good! Just a little too busy this week to do this work. Can I get a pull request if you can? I will try to get time for a review somewhere. |
@rdlabo I might also only get to work on this on Tuesday. It is a long weekend in NZ. |
@shiv19 A LONG weekend is a wonderful thing! Unfortunately I am spending my weekend working. LOL! I eagerly await your pull requests! |
Is your feature request related to a problem? Please describe.
Currently most of the failure handlers are rejecting the call with the localizedErrorMessage from the exception.
Sometimes we might need to use a different message based on the Stripe ApiError code, or a Stripe Decline Code.
Describe the solution you'd like
Instead of call.reject, we should call.resolve with
error: true
and then additional info about the error such as error code, decline code, error message, etc.This will provide a more rich error handling experience.
Usage Product
We're currently integrating this plugin into a Capacitor mobile app where field service technicians can take payments using Stripe terminal or Stripe tap to pay.
Additional Context
If there is interest to take the project in this direction, I'm happy to contribute to this.
Using Function:
The text was updated successfully, but these errors were encountered: