Class: Bugloco::Rails::Middleware

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



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

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bugloco/rails/middleware.rb', line 10

def call(env)
  Bugloco::Cache.reset!

  response = @app.call(env)

  if framework_exception = env["action_dispatch.exception"]
    env["bugloco.error_id"] = report_exception_or_ignore(framework_exception, env)
  end

  response
rescue Exception => exception
  env["bugloco.error_id"] = report_exception_or_ignore(exception, env)

  raise exception
end