diff options
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r-- | app/controllers/application_controller.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 029b536ec..d062519bc 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -12,6 +12,11 @@ require 'open-uri' class ApplicationController < ActionController::Base class PermissionDenied < StandardError end + # assign our own handler method for non-local exceptions + if ! Rails.application.config.consider_all_requests_local + rescue_from Exception, :with => :render_exception + end + # Standard headers, footers and navigation for whole site layout "default" include FastGettext::Translation # make functions like _, n_, N_ etc available) @@ -111,6 +116,14 @@ class ApplicationController < ActionController::Base end end + def render_exception(exception) + @exception_backtrace = exception.backtrace.join("\n") + @exception_class = exception.class.to_s + @exception_message = exception.message + status_code = case exception + render :template => "general/exception_caught", :status => status_code + end + # Override default error handler, for production sites. def rescue_action_in_public(exception) # Looks for before_filters called something like `set_view_paths_{themename}`. These |