Sha256: 828af666a529a5c2ec64d6b07ff00cce41f795623ce28e7e3220fbf849e182b4

Contents?: true

Size: 1.06 KB

Versions: 20

Compression:

Stored size: 1.06 KB

Contents

require 'mailman'

module Bugsnag
  ##
  # Extracts and appends mailman message information to error reports
  class Mailman

    FRAMEWORK_ATTRIBUTES = {
      :framework => "Mailman"
    }

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

    ##
    # Calls the mailman middleware.
    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
  end
end


if Mailman.config.respond_to?(:middleware)
  Mailman.config.middleware.add ::Bugsnag::Mailman
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
bugsnag-6.27.1 lib/bugsnag/integrations/mailman.rb
bugsnag-6.26.4 lib/bugsnag/integrations/mailman.rb
bugsnag-6.26.3 lib/bugsnag/integrations/mailman.rb
bugsnag-6.26.2 lib/bugsnag/integrations/mailman.rb
bugsnag-6.26.1 lib/bugsnag/integrations/mailman.rb
bugsnag-6.26.0 lib/bugsnag/integrations/mailman.rb
bugsnag-6.25.2 lib/bugsnag/integrations/mailman.rb
bugsnag-6.25.1 lib/bugsnag/integrations/mailman.rb
bugsnag-6.25.0 lib/bugsnag/integrations/mailman.rb
bugsnag-6.24.2 lib/bugsnag/integrations/mailman.rb
bugsnag-6.24.1 lib/bugsnag/integrations/mailman.rb
bugsnag-6.24.0 lib/bugsnag/integrations/mailman.rb
bugsnag-6.23.0 lib/bugsnag/integrations/mailman.rb
bugsnag-6.22.1 lib/bugsnag/integrations/mailman.rb
bugsnag-6.21.0 lib/bugsnag/integrations/mailman.rb
bugsnag-6.20.0 lib/bugsnag/integrations/mailman.rb
bugsnag-6.19.0 lib/bugsnag/integrations/mailman.rb
bugsnag-6.18.0 lib/bugsnag/integrations/mailman.rb
bugsnag-6.17.0 lib/bugsnag/integrations/mailman.rb
bugsnag-6.16.0 lib/bugsnag/integrations/mailman.rb