Class: ConfigurableExceptions::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/configurable_exceptions/middleware.rb

Overview

No way of toggling config.action_dispatch.show_exceptions directly it appears so this configurable middleware is instead injected before before the exception middleware to be able to dynamically switch them on/of for testing

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



6
7
8
# File 'lib/configurable_exceptions/middleware.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
# File 'lib/configurable_exceptions/middleware.rb', line 10

def call(env)
  env['action_dispatch.show_exceptions'] = ConfigurableExceptions.show_exceptions
  @app.call(env)
end