Skip to content
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

read_metadata lacks standard error handling #576

Closed
huddlej opened this issue Jun 26, 2020 · 0 comments · Fixed by #584
Closed

read_metadata lacks standard error handling #576

huddlej opened this issue Jun 26, 2020 · 0 comments · Fixed by #584
Labels
breaking Makes a backwards incompatible change and should wait for major release bug Something isn't working easy problem Requires less work than most issues good first issue A relatively isolated issue appropriate for first-time contributors priority: moderate To be resolved after high priority issues

Comments

@huddlej
Copy link
Contributor

huddlej commented Jun 26, 2020

Current Behavior

The read_metadata function in augur.utils allows users to pass invalid filenames or existing files with missing columns and returns an empty metadata set in each of these cases.

Expected behavior

read_metadata should raise appropriate errors when it receives invalid inputs. These invalid inputs most likely represent issues with the input data or the way the user is calling the function. By silently accepting these errors, read_metadata masks real issues with the data.

How to reproduce

See unit tests for missing and invalid files names and files with missing strain/name fields.

Possible solution

Empty, invalid, or missing filenames should raise a FileNotFound exception and not return an empty result set. This exception is raised by pandas when read_csv is called.

An existing file that doesn't have a strain or name column should raise a KeyError exception instead of an empty set. This exception corresponds to the case when a user would try to access a key of a dictionary that did not exist. Since strain or name are required for downstream analyses, we need to raise an exception when they are missing.

Additional context

This issue was raised by contribution of unit tests for the unexpected behavior in #564.

@huddlej huddlej added bug Something isn't working good first issue A relatively isolated issue appropriate for first-time contributors priority: moderate To be resolved after high priority issues easy problem Requires less work than most issues breaking Makes a backwards incompatible change and should wait for major release labels Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Makes a backwards incompatible change and should wait for major release bug Something isn't working easy problem Requires less work than most issues good first issue A relatively isolated issue appropriate for first-time contributors priority: moderate To be resolved after high priority issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant