Module: Cms::ErrorHandling

Included in:
ApplicationController
Defined in:
app/controllers/cms/error_handling.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(controller) ⇒ Object



3
4
5
6
7
# File 'app/controllers/cms/error_handling.rb', line 3

def self.included(controller)
  controller.class_eval do
      rescue_from Exception, :with => :handle_server_error
  end
end

Instance Method Details

#handle_server_error(exception) ⇒ Object



9
10
11
12
13
14
15
# File 'app/controllers/cms/error_handling.rb', line 9

def handle_server_error(exception)
  logger.error "Handling Exception: #{exception}"
  render :layout => 'cms/application', 
    :template => 'cms/shared/error', 
    :status => :internal_server_error,
    :locals => {:exception => exception}
end