Class: Bugsnag::Mailman

Inherits:
Object
  • Object
show all
Defined in:
lib/bugsnag/integrations/mailman.rb

Overview

Extracts and appends mailman message information to error reports

Constant Summary collapse

FRAMEWORK_ATTRIBUTES =
{
  :framework => "Mailman"
}

Instance Method Summary collapse

Constructor Details

#initializeMailman

Returns a new instance of Mailman.



12
13
14
15
16
# File 'lib/bugsnag/integrations/mailman.rb', line 12

def initialize
  Bugsnag.configuration.internal_middleware.use(Bugsnag::Middleware::Mailman)
  Bugsnag.configuration.detected_app_type = "mailman"
  Bugsnag.configuration.runtime_versions["mailman"] = ::Mailman::VERSION
end

Instance Method Details

#call(mail) ⇒ Object

Calls the mailman middleware.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/bugsnag/integrations/mailman.rb', line 20

def call(mail)
  begin
    Bugsnag.configuration.set_request_data :mailman_msg, mail.to_s
    yield
  rescue Exception => ex
    Bugsnag.notify(ex, true) do |report|
      report.severity = "error"
      report.severity_reason = {
        :type => Bugsnag::Report::UNHANDLED_EXCEPTION_MIDDLEWARE,
        :attributes => FRAMEWORK_ATTRIBUTES
      }
    end
    raise
  ensure
    Bugsnag.configuration.clear_request_data
  end
end