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

Closed
julienmweb opened this issue Sep 18, 2024 · 5 comments · Fixed by #1919
Closed

stripeClient throw JsonSyntaxException instead of StripeException #1868

julienmweb opened this issue Sep 18, 2024 · 5 comments · Fixed by #1919

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
@ramya-stripe
Copy link
Contributor

Thanks for reporting @julienmweb
We will add this to our backlog

@mmvaubrun
Copy link

Hello, we face the same problem and it prevents us from upgrading: version 28.0.0 is also causing the same kind of issue

Is there a way to prioritise it ? 🙏

@helenye-stripe
Copy link
Contributor

Hi, sorry about the delay and trouble caused here! We are looking into this issue.

@helenye-stripe
Copy link
Contributor

This is fixed in the new release v28.0.1!

@julienmweb
Copy link
Author

thank you !🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants