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

Handle empty or broken JSON file #72

Open
stratofax opened this issue Aug 16, 2022 · 3 comments
Open

Handle empty or broken JSON file #72

stratofax opened this issue Aug 16, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@stratofax
Copy link
Collaborator

Currently, NISTLib will throw an exception when it tries to read an EDF that doesn't contain the expected data, but BallotMaker doesn't handle or log these exceptions.

@stratofax stratofax added the bug Something isn't working label Aug 16, 2022
@trustthevote
Copy link
Member

If NISTLib is a library used by BallotMaker to ingest an EDF, then there is no need for later (running after ingestion) code to re-validate an EDF

@stratofax stratofax changed the title Test for empty or broken JSON file Handle empty or broken JSON file Aug 16, 2022
@stratofax
Copy link
Collaborator Author

Thanks for the feedback, I realized the Issue title is misleading. I agree 100% that testing the EDF should only happen once.

The issue is that the NISTLib responds to errors in the JSON file by throwing an exception, which means that program execution is immediately halted. I'd like to set up the app so the exception will be logged and the app will exit gracefully with a message (that doesn't include a stack trace) and an error code.

However, since we are currently in complete control of the contents of any JSON data we feed to BallotMaker, there's absolutely no reason to implement this feature right now. For that reason, this issue is not tied to any milestone; instead, I'm listing it here so it doesn't fall throught the cracks.

I've updated the title with the hopefully more descriptive "Handle" verb, instead of the confusing "Test for" description.

@stratofax
Copy link
Collaborator Author

Ultimately I'd like to migrate all of the error handling to Python's exception mechanism, including the current code that handles file input errors using error codes from strerror / errno.

Applies to these modules:

  • cli
  • constants
  • election_data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants