Skip to content

Log swallowed OSM fetch errors and guard missing 'highway' column - #160

Open
fotisanpetprojects wants to merge 1 commit into
marceloprates:mainfrom
fotisanpetprojects:fix/silent-fetch-exceptions
Open

Log swallowed OSM fetch errors and guard missing 'highway' column#160
fotisanpetprojects wants to merge 1 commit into
marceloprates:mainfrom
fotisanpetprojects:fix/silent-fetch-exceptions

Conversation

@fotisanpetprojects

Copy link
Copy Markdown

Fixes #159, Fixes #154

fetch.py had two bare except Exception: blocks that silently discarded every error during Overpass/OSM fetches (rate limits, timeouts, malformed responses), returning an empty GeoDataFrame with no trace of what failed. One of them even had its diagnostic print commented out.

This made failures undebuggable, and could cascade into a KeyError: 'highway' crash in draw.py's graph_to_shapely when a failed street-layer fetch left the GeoDataFrame without a highway column.

Changes:

  • fetch.py: log the exception via logging.warning instead of discarding it silently (both call sites)
  • draw.py: fall back to NaN width when highway is missing instead of crashing, so the layer is just dropped (same as the existing "no known width" path)

Tested: full pytest suite passes (9/9), plus manual smoke-test renders across several locations.

fetch.py caught every exception during Overpass fetches and silently
returned an empty GeoDataFrame, with no indication of what failed
(rate limit, timeout, malformed response). This made failures
undebuggable and led to a downstream KeyError: 'highway' in
graph_to_shapely when a street-layer fetch failed and left the gdf
without a 'highway' column.

- fetch.py: log the exception instead of discarding it silently
- draw.py: fall back to NaN width when 'highway' is missing, instead
  of crashing

Fixes marceloprates#159, marceloprates#154
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant