Skip to content

Commit f5c8d74

Browse files
committed
add stop and error if no results
1 parent d6a6773 commit f5c8d74

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/stac_api_validator/validations.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,10 @@ def validate_item_search_datetime(
15571557
if not body:
15581558
return
15591559
else:
1560-
dt = body["features"][0]["properties"]["datetime"] # todo: if no results, fail
1560+
if len(body["features"]) == 0:
1561+
errors += f"[{Context.ITEM_SEARCH}] GET Search returned no results."
1562+
return
1563+
dt = body["features"][0]["properties"]["datetime"]
15611564

15621565
_, body, _ = retrieve(
15631566
Method.GET,

0 commit comments

Comments
 (0)