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

Update to new error response json format #40

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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