Class: David::ShowExceptions

Inherits:
Object
  • Object
show all
Defined in:
lib/david/show_exceptions.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ShowExceptions

Returns a new instance of ShowExceptions.


3
4
5
# File 'lib/david/show_exceptions.rb', line 3

def initialize(app)
  @app = app
end

Instance Method Details

#_call(env) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/david/show_exceptions.rb', line 11

def _call(env)
  @app.call(env)
rescue Exception => exception
  if env['action_dispatch.show_exceptions'] == false
    raise exception
  end

  @env = env

  render_exception(exception)
end

#call(env) ⇒ Object


7
8
9
# File 'lib/david/show_exceptions.rb', line 7

def call(env)
  dup._call(env)
end