Skip to content

Commit

Permalink
Fix #142: catch StopIteration and return InvalidProductError
Browse files Browse the repository at this point in the history
  • Loading branch information
jteulade committed Jun 3, 2024
1 parent b79ed4f commit 83f1cca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion eoreader/products/sar/cosmo_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(
try:
product_path = AnyPath(product_path)
self._img_path = next(product_path.glob("*.h5"))
except IndexError as ex:
except (IndexError, StopIteration) as ex:
raise InvalidProductError(
f"Image file (*.h5) not found in {product_path}"
) from ex
Expand Down
2 changes: 1 addition & 1 deletion eoreader/products/sar/rcm_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def wgs84_extent(self) -> gpd.GeoDataFrame:
try:
extent_file = next(self.path.joinpath("preview").glob("*mapOverlay.kml"))
product_kml = vectors.read(extent_file)
except IndexError as ex:
except (IndexError, StopIteration) as ex:
raise InvalidProductError(
f"Extent file (product.kml) not found in {self.path}"
) from ex
Expand Down

0 comments on commit 83f1cca

Please sign in to comment.