This repository has been archived by the owner on Dec 4, 2018. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit fixes a 500 error that's caused by trying to hit an invalid or missing diff, e.g. one where the node requested is in neither of the two versions being diffed. An example URL that can be hit locally for Reg B is
http://localhost:8000/eregulations/diff/1002-99/2013-22752_20140101/2013-22752_20140118?from_version=2013-22752_20140118
This node doesn't exist in either of the two (unlike
1002-1
, which does), and currently causes aKeyError
by looking for a missinglabel
field in a generated node, which is actually empty.This change detects if the built tree is empty, and, if so, just raises a 404 error instead.
Unfortunately, while it'd be nice to add unit tests for this, it's a little bit tricky because of the way this code is written. It'd require a larger refactor to write a test for this. This can be tested manually using the URL above.