Skip to content

Commit

Permalink
upd error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
freekode committed Apr 30, 2024
1 parent adadd55 commit a1f8d6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyopenweathermap"
version = "0.0.7"
version = "0.0.8"
description = "lib for OpenWeatherMap for Home Assistant"
authors = ["Evgeny <[email protected]>"]
license = "MIT"
Expand Down
6 changes: 5 additions & 1 deletion src/pyopenweathermap/owm_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ async def _request(self, url):
elif response.status == 429:
raise TooManyRequestsError(response_json.get('message'))
else:
raise RequestError("Unknown Error")
raise RequestError("Unknown status code: {}".format(response.status))
except TimeoutError:
raise RequestError("Request timeout")
except RequestError as error:
raise error
except Exception as error:
raise RequestError(error) from error

def _get_url(self, lat, lon, exclude):
return (f"{API_URL}?"
Expand Down

0 comments on commit a1f8d6d

Please sign in to comment.