Skip to content

Commit 0eda3a0

Browse files
committed
use try except
1 parent d0c8a38 commit 0eda3a0

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
@@ -309,14 +309,13 @@ async def post_search(
309309
search=search, op=op, field=field, value=value
310310
)
311311

312-
filter_lang = getattr(search_request, "filter_lang", None)
313-
312+
# only cql2_json is supported here
314313
if hasattr(search_request, "filter"):
315314
cql2_filter = getattr(search_request, "filter", None)
316-
if filter_lang == FilterLang.cql2_text:
317-
raise Exception("CQL2-Text is not supported with POST")
318-
else:
315+
try:
319316
search = self.database.apply_cql2_filter(search, cql2_filter)
317+
except Exception:
318+
raise HTTPException(status_code=400, detail="Error with cql2_json filter")
320319

321320
sort = None
322321
if search_request.sortby:

0 commit comments

Comments
 (0)