Skip to content

Commit

Permalink
error handling for invalid dataset passed to datasets keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
kim committed Nov 6, 2023
1 parent aa5537c commit d33cdbc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions asf_search/CMR/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ def translate_opts(opts: ASFSearchOptions) -> list:
if 'collections' not in dict_opts:
dict_opts['collections'] = []

for collection in dict_opts['datasets']:
dict_opts['collections'].extend(platform_datasets[collection])
for dataset in dict_opts['datasets']:
if dataset_collections := platform_datasets.get(dataset):
dict_opts['collections'].extend(dataset_collections)
else:
raise ValueError(f'Could not find dataset named "{dataset}" provided for datasets keyword.')

dict_opts.pop('datasets')

Expand Down

0 comments on commit d33cdbc

Please sign in to comment.