growthbook / growthbook-sdk-java

The Java SDK for GrowthBook (JVM, Android)
https://docs.growthbook.io/lib/java
MIT License
7 stars 10 forks source link

Gracefully handle error response codes on features repository initialization #40

Open micpalmia opened 10 months ago

micpalmia commented 10 months ago

At the moment, HTTP status codes different than 200 are completely ignored. This leads to confusing error messages that don't help clients debug the issue quickly. Adding a check for the return status code helps ensure a more meaningful error message can be returned.

Ideally, the body of the response should be logged rather than provided in the exception message. In the absence of a logging framework in the library however, I think emitting the body in the message can help debugging.

Happy to adapt as needed if you have any feedback.

Bohdan-Kim commented 3 weeks ago

I agree, the body of the response should be logged rather than provided in the exception message.