[refs #374] Uncomment 404/500/503 rescues

This commit is contained in:
konstantin.grabar 2012-08-08 18:08:56 +04:00
parent 1e0a9209c3
commit 7f475948f6
1 changed files with 16 additions and 17 deletions

View File

@ -21,25 +21,24 @@ class ApplicationController < ActionController::Base
end
end
#rescue_from Exception do |exception|
# respond_to do |format|
# format.json { render :json => {:message => t("flash.500_message")}.to_json }
# format.html { redirect_to '/500.html', :alert => t("flash.500_message") }
# end
#end
rescue_from Exception do |exception|
respond_to do |format|
format.json { render :json => {:message => t("flash.500_message")}.to_json }
format.html { redirect_to '/500.html', :alert => t("flash.500_message") }
end
end
rescue_from Grit::NoSuchPathError, :with => :not_found
#[ActiveRecord::RecordNotFound,
# ActionController::RoutingError,
# ActionController::UnknownController,
# ActionController::UnknownAction].each do |ext|
# rescue_from ext do |exception|
# respond_to do |format|
# format.json { render :json => {:message => t("flash.404_message")}.to_json }
# format.html { redirect_to '/404.html', :alert => t("flash.404_message") }
# end
# end
# end
rescue_from ActiveRecord::RecordNotFound,
ActionController::RoutingError,
ActionController::UnknownController,
ActionController::UnknownAction do |exception|
respond_to do |format|
format.json { render :json => {:message => t("flash.404_message")}.to_json }
format.html { redirect_to '/404.html', :alert => t("flash.404_message") }
end
end
protected