class Noise::BugsnagMiddleware
Configures Bugsnag notification with our request-specific information.
Public Class Methods
new(bugsnag)
click to toggle source
# File lib/noise/bugsnag_middleware.rb, line 8 def initialize(bugsnag) @bugsnag = bugsnag end
Public Instance Methods
call(report)
click to toggle source
@param report [Bugsnag::Report]
# 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