Skip to content

Commit 4ef940d

Browse files
authored
Merge pull request #306 from romeokienzler/fix_validator_2
add stop and error if no results
2 parents c164b0d + f5c8d74 commit 4ef940d

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
@@ -1947,7 +1947,10 @@ def validate_item_search_datetime(
19471947
if not body:
19481948
return
19491949
else:
1950-
dt = body["features"][0]["properties"]["datetime"] # todo: if no results, fail
1950+
if len(body["features"]) == 0:
1951+
errors += f"[{Context.ITEM_SEARCH}] GET Search returned no results."
1952+
return
1953+
dt = body["features"][0]["properties"]["datetime"]
19511954

19521955
_, body, _ = retrieve(
19531956
Method.GET,

0 commit comments

Comments
 (0)