merge-api / merge-java-client

The JVM SDK for accessing various Merge Unified APIs
Other
3 stars 5 forks source link

Handle errors with null response bodies #34

Closed clamey closed 3 months ago

clamey commented 7 months ago

Currently we're seeing errors like this:

com.merge.api.core.ApiError: null
    at com.merge.api.resources.ticketing.tickets.TicketsClient.create(TicketsClient.java:240)

My guess is that response.body() is null on some error, so this change puts a safeguard in place to avoid the NPE.

clamey commented 7 months ago

Looking at this a bit more - looks to me like maybe a Java/Kotlin null issue. ApiError should be ok with null values, and a NPE on response.body() would look different.

clamey commented 7 months ago

FYI - these are associated with 400 and 404s coming back from ADO to Merge

dsinghvi commented 7 months ago

@clamey thanks for filing this issue, we'll report back when the issue is fixed in our generator!

clamey commented 7 months ago

Hiya - similar thing with comments too - this was from a 404 back from ADO:

com.merge.api.core.ApiError: null
    at com.merge.api.resources.ticketing.comments.CommentsClient.create(CommentsClient.java:164)
fern-bot commented 3 months ago

This is now fixed!