Skip to content

Commit 2a0be3c

Browse files
TsadoqCopilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 67c5f57 commit 2a0be3c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

kompy/komoot_connector.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,13 @@ def get_tours(
191191
current_page = response['page']['number'] + 1
192192
logger.info(f'Fetched page {current_page} of {max_page}.')
193193
fetch_more = (current_page < max_page) if limit is None else False
194+
# Skip tours that cannot be parsed into Tour objects.
194195
tour_objects = []
195196
for tour_dict in tours:
196197
try:
197198
tour_objects.append(Tour(tour_dict))
198-
except Exception as e:
199-
logger.warning(f'Failed to parse tour {tour_dict.get("id", "unknown")}: {e}')
199+
except (KeyError, TypeError, ValueError) as e:
200+
logger.exception(f'Failed to parse tour {tour_dict.get("id", "unknown")}: {e}')
200201
return tour_objects
201202

202203
def get_tour_by_id(

0 commit comments

Comments
 (0)