Skip to content

Commit

Permalink
catch empty data
Browse files Browse the repository at this point in the history
  • Loading branch information
dgomes committed Sep 12, 2022
1 parent 0c968c9 commit 1be7df4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyipma/auxiliar.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ async def get_location(self, lon, lat):
if not self.data:
raw = await self.api.retrieve(url=self.endpoint)

if raw is None:
raise Exception(f"Could not retrieve location for {lon}, {lat}")

self.data = self._data_to_obj_list(raw)

if (lon, lat) != (None, None):
Expand Down

0 comments on commit 1be7df4

Please sign in to comment.