Skip to content
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

Add StripeError field to StripeException #793

Merged
merged 1 commit into from
Feb 6, 2019
Merged

Conversation

mshafrir-stripe
Copy link
Collaborator

Summary
Add a StripeError field to StripeException.
Access via StripeException#getStripeError()

Motivation
The error code is an important field for SDK users
to be able to determine why a request failed, and
allows them to better react to the failure.

For example, a "payment_method_not_available" code
may suggest to the developer to invite a customer to
use another payment method. Additionally, a developer
may choose to localize an user-facing error based on
this code.

Fixes #792

Testing
Wrote automated tests.

**Summary**
Add a `StripeError` field to `StripeException`.
Access via `StripeException#getStripeError()`

**Motivation**
The error code is an important field for SDK users
to be able to determine why a request failed, and
allows them to better react to the failure.

For example, a `"payment_method_not_available"` code
may suggest to the developer to invite a customer to
use another payment method. Additionally, a developer
may choose to localize an user-facing error based on
this code.

Fixes #792

**Testing**
Wrote automated tests.
@mshafrir-stripe mshafrir-stripe merged commit 44e1bf9 into master Feb 6, 2019
@mshafrir-stripe mshafrir-stripe deleted the stripe-error branch February 6, 2019 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants