Skip to content

Commit f127403

Browse files
committed
return error msg
1 parent 8f4af84 commit f127403

File tree

1 file changed

+4
-5
lines changed
  • stac_fastapi/elasticsearch/stac_fastapi/elasticsearch

1 file changed

+4
-5
lines changed

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/core.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,8 @@ async def item_collection(
105105
collection = await self.get_collection(
106106
collection_id=collection_id, request=request
107107
)
108-
try:
109-
collection_id = collection["id"]
110-
except Exception:
108+
collection_id = collection.get("id")
109+
if collection_id is None:
111110
raise HTTPException(status_code=404, detail="Collection not found")
112111

113112
search = self.database.make_search()
@@ -313,9 +312,9 @@ async def post_search(
313312
cql2_filter = getattr(search_request, "filter", None)
314313
try:
315314
search = self.database.apply_cql2_filter(search, cql2_filter)
316-
except Exception:
315+
except Exception as e:
317316
raise HTTPException(
318-
status_code=400, detail="Error with cql2_json filter"
317+
status_code=400, detail=f"Error with cql2_json filter: {e}"
319318
)
320319

321320
sort = None

0 commit comments

Comments
 (0)