projectblacklight/blacklight — pull request #766 by jrochkind (2014-02-10 23:29:23+00:00)
Title: default invalid_solr_id_error just a default 404 

much like ActiveRecord::RecordNotFound

Fixes #756.

My goals were:

1) Leave `#invalid_solr_id_error` there so local apps can easily override it to do more complicated things
2) the simple implementation should be as much as possible like what Rails by default, in production, does with uncaught `ActiveRecord::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.