Class: Locomotive::Steam::Middlewares::CatchError

Inherits:
Object
  • Object
show all
Defined in:
lib/locomotive/steam/middlewares/catch_error.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, opts = {}) ⇒ CatchError

Returns a new instance of CatchError.


7
8
9
# File 'lib/locomotive/steam/middlewares/catch_error.rb', line 7

def initialize(app, opts = {})
  @app = app
end

Instance Method Details

#call(env) ⇒ Object


11
12
13
14
15
16
17
# File 'lib/locomotive/steam/middlewares/catch_error.rb', line 11

def call(env)
  begin
    @app.call(env)
  rescue Exception => e
    handle_exception(e, env)
  end
end