default invalid_solr_id_error just a default 404 #766
Merged
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.
much like ActiveRecord::RecordNotFound
Fixes #756.
My goals were:
#invalid_solr_id_error
there so local apps can easily override it to do more complicated thingsActiveRecord::RecordNotFound
This solution does that. Another solution that would also is to have our
invalid_solr_id_error
simply raise a ActionController::RoutingError. In production, if that is raised and not caught, Rails will display the standard default 404.html page, or an appropriate XML or JSON response in html or json format.However, Rails will only do that in production, in dev and importantly test, it will not. Which means, if we did id that way, our tests couldn't actually test for status 404, they'd just test for
raises ActionController::RoutingError
. I didn't like that in the tests.But if people would prefer the
raise ActionController::RoutingError
implementation, I am quite happy to change to that one.