Skip to content

Commit

Permalink
add KeyError (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
miaucl authored Jan 3, 2024
1 parent f336532 commit e3f4b6d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changes
=======

20231213 - 0.4.1
----------------

- Add KeyError exception (thanks @miaucl)

20231120 - 0.4.0
----------------

Expand Down
6 changes: 3 additions & 3 deletions opendata_transport/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async def async_get_data(self):
try:
for station in data["stations"]:
self.locations.append(self.get_station(station))
except (TypeError, IndexError):
except (KeyError, TypeError, IndexError):
raise exceptions.OpendataTransportError()


Expand Down Expand Up @@ -174,7 +174,7 @@ async def __async_get_data(self, station):
try:
for journey in data["stationboard"]:
self.journeys.append(self.get_journey(journey))
except (TypeError, IndexError):
except (KeyError, TypeError, IndexError):
raise exceptions.OpendataTransportError()

async def async_get_data(self):
Expand Down Expand Up @@ -309,5 +309,5 @@ async def async_get_data(self):
for connection in data["connections"]:
self.connections[index] = self.get_connection(connection)
index = index + 1
except (TypeError, IndexError):
except (KeyError, TypeError, IndexError):
raise exceptions.OpendataTransportError()

0 comments on commit e3f4b6d

Please sign in to comment.