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

stripeClient throw JsonSyntaxException instead of StripeException #1868

Open
julienmweb opened this issue Sep 18, 2024 · 0 comments
Open

stripeClient throw JsonSyntaxException instead of StripeException #1868

julienmweb opened this issue Sep 18, 2024 · 0 comments
Labels

Comments

@julienmweb
Copy link

julienmweb commented Sep 18, 2024

Describe the bug

Hi
After upgrading the com.stripe:stripe-java dependency from version 26.9.0 to 26.11.0, a test in our project fails:

The test expects stripeClient to throw a StripeException, but instead, a com.google.gson.JsonSyntaxException is thrown.
It looks like the JsonSyntaxException is thrown directly instead of being encapsulated within a StripeException like in the previous version

To Reproduce

Create a test:
Configure WireMock to return an invalid JSON response when the stripeClient do a call
a JsonSyntaxException should be thrown

java.lang.AssertionError: Expecting actual throwable to be an instance of: com.stripe.exception.StripeException but was: com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonObject but was com.google.gson.JsonPrimitive; at path $ at com.google.gson.internal.bind.TypeAdapters$34$1.read(TypeAdapters.java:1152) at com.google.gson.Gson.fromJson(Gson.java:1361) at com.google.gson.Gson.fromJson(Gson.java:1262) ...(93 remaining lines not displayed - this can be changed with Assertions.setMaxStackTraceElementsDisplayed)

Expected behavior

stripeClient should throw a StripeException

Code snippets

No response

OS

linux

Java version

21

stripe-java version

v26.11.0

API version

2024-06-20

Additional context

No response

@julienmweb julienmweb added the bug label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant