As stated in this post:
http://blog.plataformatec.com.br/2012/01/my-five-favorite-hidden-features-in-rails-3-2/
The newest error handling method is as follows:
# application.rb: config.exceptions_app = self.routes #routes.rb match "/404", to: "site#not_found"
However, it does not take into account the fact that the error rails application also handles 500 errors, 422 errors (and, possibly, other errors directed to these two pages?)
So, I hacked a solution that looks like this:
# routes.rb rack_error_handler = ActionDispatch::PublicExceptions.new('public/') match "/422" => rack_error_handler match "/500" => rack_error_handler
Itβs good that he holds my 500 pages lightweight.
Are there any other bugs I have to catch? My understanding is that although two rack applications will be used on a 500-page page, it is still safely isolated from the main Rails application. Is it strong?
Thanks!
Peter Ehrlich
source share