Class: Crashbreak::ExceptionCatcherMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/crashbreak/exception_catcher_middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ExceptionCatcherMiddleware

Returns a new instance of ExceptionCatcherMiddleware.



3
4
5
# File 'lib/crashbreak/exception_catcher_middleware.rb', line 3

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/crashbreak/exception_catcher_middleware.rb', line 7

def call(env)
  begin
    @app.call(env)
  rescue ::Exception => exception
    unless skip_exception?(exception)
      RequestStore.store[:exception] = exception
      store_variables_from_env env
      exception_notifier.notify
    end

    raise
  end
end