Skip to content
This repository was archived by the owner on Dec 5, 2023. It is now read-only.
This repository was 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

Description

@stark525

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions