Sha256: ac17b0579d8f261d0931c1ea61bbb7f3e684f5152f1bf6e035ca119380dc0705

Contents?: true

Size: 635 Bytes

Versions: 2

Compression:

Stored size: 635 Bytes

Contents

require 'sidekiq/util'

module Sidekiq
  module Middleware
    module Server
      class Airbrake
        include Util
        def call(*args)
          yield
        rescue => ex
          logger.warn ex
          logger.warn ex.backtrace.join("\n")
          send_to_airbrake(args[1], ex) if defined?(::Airbrake)
          raise
        end

        private

        def send_to_airbrake(msg, ex)
          ::Airbrake.notify(:error_class   => ex.class.name,
                            :error_message => "#{ex.class.name}: #{ex.message}",
                            :parameters    => msg)
        end
      end
    end
  end
end



Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sidekiq-0.7.0 lib/sidekiq/middleware/server/airbrake.rb
sidekiq-0.6.0 lib/sidekiq/middleware/server/airbrake.rb