Class: Noise::BugsnagMiddleware
- Inherits:
-
Object
- Object
- Noise::BugsnagMiddleware
- Defined in:
- lib/noise/bugsnag_middleware.rb
Overview
Configures Bugsnag notification with our request-specific information.
Instance Method Summary collapse
- #call(report) ⇒ Object
-
#initialize(bugsnag) ⇒ BugsnagMiddleware
constructor
A new instance of BugsnagMiddleware.
Constructor Details
#initialize(bugsnag) ⇒ BugsnagMiddleware
Returns a new instance of BugsnagMiddleware.
8 9 10 |
# File 'lib/noise/bugsnag_middleware.rb', line 8 def initialize(bugsnag) @bugsnag = bugsnag end |
Instance Method Details
#call(report) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/noise/bugsnag_middleware.rb', line 14 def call(report) env = report.request_data.fetch(:rack_env, {}) # Bugsnag::Notification unwraps stacked exceptions, # top-level exception (which we need) is the first. error = report.exceptions.first notification = Notification.new(error, env) report.severity = notification.severity report.user = notification.user_info notification.to_hash.each_pair do |tab_name, value| report.add_tab(tab_name, value) end @bugsnag.call(report) end |