Skip to content

Commit

Permalink
Capture all rio errors #122
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill888 committed Nov 30, 2023
1 parent aa88c69 commit e46dea8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion odc/stac/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,27 @@ def rio_read(

try:
return _rio_read(src, cfg, dst_geobox, dst)
except rasterio.errors.RasterioIOError as e:
except (
rasterio.errors.RasterioIOError,
rasterio.errors.RasterBlockError,
rasterio.errors.WarpOperationError,
rasterio.errors.WindowEvaluationError,
) as e:
if cfg.fail_on_error:
log.error(
"Aborting load due to failure while reading: %s:%d",
src.uri,
src.band,
)
raise e
except rasterio.errors.RasterioError as e:
if cfg.fail_on_error:
log.error(
"Aborting load due to some rasterio error: %s:%d",
src.uri,
src.band,
)
raise e

# Failed to read, but asked to continue
log.warning("Ignoring read failure while reading: %s:%d", src.uri, src.band)
Expand Down

0 comments on commit e46dea8

Please sign in to comment.