Sha256: 2deb1084f9f8af93ee2cb41c9005dd8fc6eccaf14705c0b1aff1db71abc48e06

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

module Sidekiq
  module ExceptionHandler

    def handle_exception(ex, ctxHash)
      Sidekiq.logger.warn ctxHash
      Sidekiq.logger.warn ex
      Sidekiq.logger.warn ex.backtrace.join("\n")
      # This list of services is getting a bit ridiculous.
      # For future error services, please add your own
      # middleware like BugSnag does:
      # https://github.com/bugsnag/bugsnag-ruby/blob/master/lib/bugsnag/sidekiq.rb
      send_to_airbrake(ctxHash, ex) if defined?(::Airbrake)
      send_to_honeybadger(ctxHash, ex) if defined?(::Honeybadger)
      send_to_exceptional(ctxHash, ex) if defined?(::Exceptional)
      send_to_exception_notifier(ctxHash, ex) if defined?(::ExceptionNotifier)
    end

    private

    def send_to_airbrake(hash, ex)
      ::Airbrake.notify_or_ignore(ex, :parameters => hash)
    end

    def send_to_honeybadger(hash, ex)
      ::Honeybadger.notify_or_ignore(ex, :parameters => hash)
    end

    def send_to_exceptional(hash, ex)
      if ::Exceptional::Config.should_send_to_api?
        ::Exceptional.context(hash)
        ::Exceptional::Remote.error(::Exceptional::ExceptionData.new(ex))
      end
    end

    def send_to_exception_notifier(hash, ex)
      ::ExceptionNotifier.notify_exception(ex, :data => {:message => hash})
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sidekiq-2.14.1 lib/sidekiq/exception_handler.rb
sidekiq-2.14.0 lib/sidekiq/exception_handler.rb