Skip to content

Instantly share code, notes, and snippets.

@erikpukinskis
Created June 16, 2011 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikpukinskis/1029983 to your computer and use it in GitHub Desktop.
Save erikpukinskis/1029983 to your computer and use it in GitHub Desktop.
# in ApplicationController:
unless Rails.application.config.consider_all_requests_local
rescue_from Exception, NoMethodError, :with => :render_500
rescue_from ActiveRecord::RecordNotFound,
ActionController::RoutingError,
ActionController::UnknownController,
ActionController::UnknownAction, :with => :render_404
end
private
def render_404(e)
log_error(e)
Exceptional::Catcher.handle_with_controller(e, self, request)
render :template => "site/404", :layout => 'application', :status => :not_found
end
def render_500(e)
log_error(e)
Exceptional::Catcher.handle_with_controller(e, self, request)
render :template => "site/500", :layout => 'application', :status => :internal_server_error
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment