Class: Timber::Integrations::Rack::ErrorEvent

Inherits:
Middleware
  • Object
show all
Defined in:
lib/timber-rack/error_event.rb

Overview

A Rack middleware that is reponsible for capturing exception and error events

Instance Method Summary collapse

Methods inherited from Middleware

enabled=, enabled?, #initialize

Constructor Details

This class inherits a constructor from Timber::Integrations::Rack::Middleware

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/timber-rack/error_event.rb', line 10

def call(env)
  begin
    status, headers, body = @app.call(env)
  rescue Exception => exception
    Config.instance.logger.fatal do
      Events::Error.new(
        name: exception.class.name,
        error_message: exception.message,
        backtrace: exception.backtrace
      )
    end

    raise exception
  end
end