Class: SimplificatorInfrastructure::ErrorPageHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/simplificator_infrastructure/error_page_handler.rb

Class Method Summary collapse

Class Method Details

.enable_error_page_renderingObject



10
11
12
13
14
15
# File 'lib/simplificator_infrastructure/error_page_handler.rb', line 10

def self.enable_error_page_rendering
  # Enables rendering of error pages.
  # Those settings are usually set up properly in staging/production environments anyway.
  Rails.application.config.consider_all_requests_local = false
  Rails.application.config.action_dispatch.show_exceptions = true
end

.registerObject



3
4
5
6
# File 'lib/simplificator_infrastructure/error_page_handler.rb', line 3

def self.register
  enable_error_page_rendering
  register_exception_app
end

.register_exception_appObject



17
18
19
20
21
22
# File 'lib/simplificator_infrastructure/error_page_handler.rb', line 17

def self.register_exception_app
  Rails.application.config.exceptions_app = lambda do |env|
    action = SimplificatorInfrastructure::ErrorsController.action(:render_error)
    action.call(env)
  end
end