Sha256: 7e9248f8736ed28f79bbbe239b9a590920fb8d7264695eeba50835395d8c6b90

Contents?: true

Size: 1.26 KB

Versions: 30

Compression:

Stored size: 1.26 KB

Contents

module Sidekiq
  module ExceptionHandler

    def handle_exception(ex, msg)
      Sidekiq.logger.warn msg
      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(msg, ex) if defined?(::Airbrake)
      send_to_honeybadger(msg, ex) if defined?(::Honeybadger)
      send_to_exceptional(msg, ex) if defined?(::Exceptional)
      send_to_exception_notifier(msg, ex) if defined?(::ExceptionNotifier)
    end

    private

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

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

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

    def send_to_exception_notifier(msg, ex)
      ::ExceptionNotifier::Notifier.background_exception_notification(ex, :data => { :message => msg }).deliver
    end
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
sidekiq-2.13.0 lib/sidekiq/exception_handler.rb
sidekiq-2.12.4 lib/sidekiq/exception_handler.rb
sidekiq-2.12.3 lib/sidekiq/exception_handler.rb
sidekiq-2.12.1 lib/sidekiq/exception_handler.rb
sidekiq-statsd-0.1.1 vendor/ruby/1.9.1/gems/sidekiq-2.11.2/lib/sidekiq/exception_handler.rb
sidekiq-statsd-0.1.0 vendor/ruby/1.9.1/gems/sidekiq-2.11.2/lib/sidekiq/exception_handler.rb
sidekiq-2.11.2 lib/sidekiq/exception_handler.rb
sidekiq-2.11.1 lib/sidekiq/exception_handler.rb
sidekiq-2.11.0 lib/sidekiq/exception_handler.rb
sidekiq-2.10.1 lib/sidekiq/exception_handler.rb
sidekiq-2.10.0 lib/sidekiq/exception_handler.rb
sidekiq-2.9.0 lib/sidekiq/exception_handler.rb
sidekiq-2.8.0 lib/sidekiq/exception_handler.rb
sidekiq-2.7.5 lib/sidekiq/exception_handler.rb
sidekiq-2.7.4 lib/sidekiq/exception_handler.rb
sidekiq-2.7.3 lib/sidekiq/exception_handler.rb
sidekiq-2.7.2 lib/sidekiq/exception_handler.rb
sidekiq-2.7.1 lib/sidekiq/exception_handler.rb
sidekiq-2.7.0 lib/sidekiq/exception_handler.rb
sidekiq-2.6.5 lib/sidekiq/exception_handler.rb