GiorgioBalestrieri/renewables-ninja-client

[feature] add response content to error messages

Opened this issue · 0 comments

Hi @GiorgioBalestrieri!

First off, thanks for providing such a convenient client! I started using it today and it works great! 🤗

While testing, I encountered one minor inconvenience that should be easy to fix and would make renewables-ninja-client even more awesome: The error messages returned when calling query_pv or query_wind with wrong arguments are right now very generic. For example, if I try to get PV data with tilt = 100, I receive requests.exceptions.HTTPError: 400 Client Error: Bad Request for url.... However, when checking the Response object, I see that there is a more conrete error description in the content attribute: Error: tilt must be >= 0 and <= 90. I think it would be awesome if this message was returned along with the HTTP Error code.

Thanks for your effort and keep up the great work! 😃

Cheers.
Ben