X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/6db326aa1f084a062a3b658876bc01bf650f5702..8c326a6c1fcea02c2937579524c30b5c77c4d8eb:/app/controllers/application_controller.rb?ds=sidebyside diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bee5e8169..a2211ea69 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -10,7 +10,9 @@ class ApplicationController < ActionController::Base around_action :better_errors_allow_inline, :if => proc { Rails.env.development? } attr_accessor :current_user + helper_method :current_user + helper_method :preferred_langauges private @@ -185,6 +187,8 @@ class ApplicationController < ActionController::Base def api_call_handle_error yield + rescue ActionController::UnknownFormat + head :not_acceptable rescue ActiveRecord::RecordNotFound => e head :not_found rescue LibXML::XML::Error, ArgumentError => e @@ -231,7 +235,7 @@ class ApplicationController < ActionController::Base e = e.cause if e.is_a?(Timeout::Error) || - (e.is_a?(ActiveRecord::StatementInvalid) && e.message =~ /execution expired/) + (e.is_a?(ActiveRecord::StatementInvalid) && e.message.include?("execution expired")) render :action => "timeout" else raise