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

Error should be clearer when .schema.json header cannot be found #3

Closed
ethall opened this issue Feb 27, 2019 · 0 comments
Closed

Error should be clearer when .schema.json header cannot be found #3

ethall opened this issue Feb 27, 2019 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@ethall
Copy link
Collaborator

ethall commented Feb 27, 2019

Subject of the issue

When attempting to archive a file that does not contain a header expected by .schema.json, an IndexError is raised with a message saying that said header could not be found. However, it's not immediately clear that the column named in the IndexError is required because of its inclusion in the .schema.json file.

Example error:

Traceback (most recent call last):
  File "C:\Python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Source\forked\syphon\syphon\__main__.py", line 99, in <module>
    bootstrap(argv)
  File "C:\Source\forked\syphon\syphon\__main__.py", line 15, in bootstrap
    exit(_main(args))
  File "C:\Source\forked\syphon\syphon\__main__.py", line 84, in _main
    archive(this_context)
  File "C:\Source\forked\syphon\syphon\archive\archive.py", line 113, in archive
    check_columns(context.schema, data_frame)
  File "C:\Source\forked\syphon\syphon\schema\checkcolumns.py", line 27, in check_columns
    'Cannot find column named "{}"'.format(header))
IndexError: Cannot find column named "blah"

Your environment

  • Python 3.6.6
  • Syphon 0.1.1

Steps to reproduce

Attempt to archive a file or files that do not contain one or more columns required by the .schema.json in the destination.

Expected behaviour

Error message should mention why the column is required.

Actual behaviour

Error just says that the column could not be found.

@ethall ethall added the bug Something isn't working label Feb 27, 2019
@ethall ethall self-assigned this Sep 27, 2019
@ethall ethall mentioned this issue Sep 28, 2019
6 tasks
ethall added a commit that referenced this issue Sep 30, 2019
* Added check submodule

* Updated archive's functional and command-line arguments

* Updated build's functional and command-line arguments

* Having too few arguments now returns 1

* Updated trove classifiers and module description

* Removed Context for more expressive arguments

* Removed get_parser from root-level module exports

* Reorganized to resolve import collisions

* Fixed archive not checking for schema file existence

* Updated checkcolumns error message (#3)

* Error on nonexistent archive source files (#2)

* Formatted with black, isort
@ethall ethall closed this as completed Sep 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant