Skip to content

Commit

Permalink
Update to new error response json format (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
klaasnicolaas authored Jan 17, 2024
1 parent 1831ecb commit 171deff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions forecast_solar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ async def _request(
raise ForecastSolarAuthenticationError(data["message"])

if response.status == 422:
data = await response.text()
raise ForecastSolarConfigError(data)
data = await response.json()
raise ForecastSolarConfigError(data["message"])

if response.status == 429:
data = await response.json()
Expand Down
2 changes: 1 addition & 1 deletion forecast_solar/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ForecastSolarConfigError(ForecastSolarError):

def __init__(self, data: str) -> None:
"""Init a solar config error."""
super().__init__(f"{data} (error 422)")
super().__init__(f'{data["text"]} (error 422)')


class ForecastSolarAuthenticationError(ForecastSolarError):
Expand Down

0 comments on commit 171deff

Please sign in to comment.