Fail on read errors #178

Merged
merged 5 commits into from Dec 7, 2016

Conversation

Projects
None yet
2 participants
@orangejulius
Member

orangejulius commented Dec 6, 2016

The importer previously wasn't very strict about actually doing something about errors while reading files. It would swallow errors from failing to parse JSON, and not log anything extra when it couldn't read a file. Now it halts on both cases with error messages.

This took some changing to our little test_stream function, which is now getting complex enough I think we should move it to its own package soon. Additionally I had to move t.end() to the actual end of the callbacks from the stream, after stdout interception is stopped, or we can't properly track error output in the next test. I'd love to hear if anyone has ideas to make the test code cleaner, but I think it's ok.

orangejulius added some commits Dec 6, 2016

Expand test_stream function to support error handlers
In order to assert that code properly handles errors emitted in the
stream being tested, test_stream now supports an optional error handling
callback.
Throw error in loadJSON stream when JSON parsing fails
Previously, the import would continue with just that file being skipped.

@orangejulius orangejulius self-assigned this Dec 6, 2016

@orangejulius orangejulius merged commit 57a95e6 into master Dec 7, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@orangejulius orangejulius removed the in review label Dec 7, 2016

@orangejulius orangejulius deleted the fail-on-read-errors branch Dec 21, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment