Sha256: 4cf2148d0b7d5cd09bc451b7b7d7a29aa55cb4de97963513d5a51c3153d6ea80

Contents?: true

Size: 681 Bytes

Versions: 2

Compression:

Stored size: 681 Bytes

Contents

class SimplificatorInfrastructure::ErrorPageHandler

  def self.register
    enable_error_page_rendering
    register_exception_app
  end

  private

  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

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

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simplificator_infrastructure-0.0.4 lib/simplificator_infrastructure/error_page_handler.rb
simplificator_infrastructure-0.0.3 lib/simplificator_infrastructure/error_page_handler.rb