Skip to content

Report file where an error occurred during CLI operations #208

@cholmes

Description

@cholmes

Is your feature request related to a problem? Please describe.

Often I run an operation that operates on a whole catalog - usually 'copy', sometimes 'validate' or 'merge' - and I'll get an error, that reports a problem, but I have no idea where it occurs. My latest is (I think) a missing license from a 'collection':

Traceback (most recent call last):
  File "/Users/cholmes/.local/bin/stac", line 8, in <module>
    sys.exit(run_cli())
  ...
  File "/Users/cholmes/.local/lib/python3.7/site-packages/pystac/stac_io.py", line 168, in stac_object_from_dict
    d, href=href, root=root, migrate=False, preserve_dict=preserve_dict
  File "/Users/cholmes/.local/lib/python3.7/site-packages/pystac/collection.py", line 589, in from_dict
    license = d.pop("license")
KeyError: 'license'

(realizing this particular error is probably worth an issue in its own right to better report what happens, but that's not actually why I'm putting in this issue).

The problem is that I think I only have one collection, which definitely has a license, so I have no idea how to try to find where STAC is failing. I suspect it's some errant link to some older file, maybe cached in some way. But it's impossible fo rme track down which of the 50 or so STAC files has the error. The best I can do is run it on smaller and smaller sub-catalogs to try to isolate it, which is painful, and still doesn't get me all the way to which file generated the error.

Describe the solution you'd like
I would like stac errors to show me the location of the file where the exception was raised. Bonus points if it shows me the line numbers.

Describe alternatives you've considered
#51 was a similar report, and resulted in the stac validate command, which was a step in the right direction. But it still misses reporting what file an error comes from.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliCommand line interfaceenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions