Hi all,
I implemented custom 404 and 500 error pages using rescue_from according to an example I found at http://blog.ubrio.us/code/rails-22-custom-error-pages-with-exception-loggable/
Here's my version:
unless ActionController::Base.consider_all_requests_local rescue_from ActiveRecord::RecordNotFound, ActionController::RoutingError, ActionController::UnknownController, ActionController::UnknownAction, :with => :render_404 rescue_from RuntimeError, :with => :render_500 end
def render_500 render :template => "errors/error_500", :layout => 'singlecolumn', :status => 500 end
def render_404 respond_to do |type| type.html { render :template => "errors/error_404", :layout => 'singlecolumn', :status => 404 } type.all { render :nothing => true, :status => 404 } end true # so we can do "render_404 and return" end
Then I went to test it, by sticking a call to the undefined name "foobar" at the top of my homepage action. This raised a NameError, which wasn't caught by my 500 error catcher. Now, I can just add the error to the list, but I'm curious about other exceptions that could be raised that I haven't anticipated. When implementing custom error pages, which exceptions do folks like to catch?
Rafe Rosen Common Media, Inc.