Sha256: 8de06c0d2fab0792f9d013b771aee6954433f14ab51a8b8f85d1d8a1160cf9e9

Contents?: true

Size: 754 Bytes

Versions: 3

Compression:

Stored size: 754 Bytes

Contents

module Cms
  module ErrorHandling
    def self.included(controller)
      controller.class_eval do
        rescue_from Exception, :with => :handle_server_error unless RAILS_ENV == "test"
        rescue_from Cms::Errors::AccessDenied, :with => :handle_access_denied
      end
    end
    
    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
    
    def handle_access_denied(exception)
      render :layout   => 'cms/application', 
             :template => 'cms/shared/access_denied',
             :status => 403
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webficient-browsercms-3.0.2 app/controllers/cms/error_handling.rb
webficient-browsercms-3.0.3 app/controllers/cms/error_handling.rb
webficient-browsercms-3.0.4 app/controllers/cms/error_handling.rb