Class: AppInsights::ExceptionHandling

Inherits:
Object
  • Object
show all
Defined in:
lib/appinsights/middlewares/exception_handling.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ExceptionHandling



5
6
7
# File 'lib/appinsights/middlewares/exception_handling.rb', line 5

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/appinsights/middlewares/exception_handling.rb', line 9

def call(env)
  @app.call env
rescue Exception => exception
  tc = AppInsights::Context.telemetry_client
  tc.track_exception exception

  raise exception
end