-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error handling when accidentally importing a Collection with Catalog #186
Comments
This should be handled better so that the error is more interpretable. It may be worth it to run a check using identify_stac_object_type in all the specific object reads to make sure the user is doing the right thing. Also note that pystac.read_file will identify the object for you and give you back the relevant STAC object. |
Looking into this - I tried to replicate and could not. It's unclear where in the code this is throwing. Can you give reproduction steps? |
Shoot, sorry for the confusion. It looks like it doesn't throw when the
Here's the catalog I was using: |
Today I accidentally used
pystac.Catalog.from_file
to read acollection.json
instead ofpystac.Collection.from_file
and got this error:I could see a number of people making this mistake or it being a difficult to handle bug in some automated process that reads catalogs. It would be nice if this error was handled such that a specific pystac exception is thrown when this happens or it automatically switches to the collection reader when a collection is detected.
The text was updated successfully, but these errors were encountered: