Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Handle exceptions where there are no features in a feature collection #22

Open
stark525 opened this issue Jun 2, 2021 · 0 comments
Open

Comments

@stark525
Copy link

stark525 commented Jun 2, 2021

Currently, if you perform a search and a catalog does not contain any features, you'll see this:

[ERROR] KeyError: 'features'

Traceback (most recent call last):

  File "/var/task/lambda_function.py", line 47, in lambda_handler

    catalogs.append(Catalog(cat, update=True))

  File "/var/task/cirruslib/catalog.py", line 48, in __init__

    self.update()

  File "/var/task/cirruslib/catalog.py", line 108, in update

    cols = sorted(list(set([i['collection'] for i in self['features'] if 'collection' in i])))

This looks like an error, but it did not fail - there were no features in the FeatureCollection.

It'd be nice if we could handle this exception with a prettier message for developer experience.

I'm actually not sure how it's passing this assert line: https://github.com/cirrus-geo/cirrus-lib/blob/main/cirruslib/catalog.py#L62 but I will play around with it and report back in this issue.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant