Skip to content

Commit 310ec6a

Browse files
committed
improve missing collections error msgng
1 parent 290bfb6 commit 310ec6a

File tree

1 file changed

+18
-3
lines changed
  • stac_fastapi/core/stac_fastapi/core/extensions

1 file changed

+18
-3
lines changed

stac_fastapi/core/stac_fastapi/core/extensions/catalogs.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Catalogs extension."""
22

3+
import logging
34
from typing import List, Optional, Type
45
from urllib.parse import urlparse
56

@@ -13,6 +14,8 @@
1314
from stac_fastapi.types.core import BaseCoreClient
1415
from stac_fastapi.types.extension import ApiExtension
1516

17+
logger = logging.getLogger(__name__)
18+
1619

1720
@attr.s
1821
class CatalogsExtension(ApiExtension):
@@ -328,9 +331,21 @@ async def get_catalog_collections(
328331
coll_id, request=request
329332
)
330333
collections.append(collection)
331-
except Exception:
332-
# Skip collections that can't be found
333-
continue
334+
except HTTPException as e:
335+
# Only skip collections that are not found (404)
336+
if e.status_code == 404:
337+
logger.debug(f"Collection {coll_id} not found, skipping")
338+
continue
339+
else:
340+
# Re-raise other HTTP exceptions (5xx server errors, etc.)
341+
logger.error(f"HTTP error retrieving collection {coll_id}: {e}")
342+
raise
343+
except Exception as e:
344+
# Log unexpected errors and re-raise them
345+
logger.error(
346+
f"Unexpected error retrieving collection {coll_id}: {e}"
347+
)
348+
raise
334349

335350
# Return in Collections format
336351
base_url = str(request.base_url)

0 commit comments

Comments
 (0)