Sha256: 9f58745e70773bdc632caf1972c414092a17361e71cdf5819d5a90d9218fb824

Contents?: true

Size: 1.04 KB

Versions: 23

Compression:

Stored size: 1.04 KB

Contents

require 'sidekiq/util'

module Sidekiq
  module Middleware
    module Server
      class ExceptionHandler
        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)
          send_to_exceptional(args[1], ex) if defined?(::Exceptional)
          send_to_exception_notifier(args[1], ex) if defined?(::ExceptionNotifier)
          raise
        end

        private

        def send_to_airbrake(msg, ex)
          ::Airbrake.notify(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 })
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
sidekiq-2.1.0 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-2.0.3 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-2.0.2 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-2.0.1 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-2.0.0 lib/sidekiq/middleware/server/exception_handler.rb
kulesa-sidekiq-1.2.3 lib/sidekiq/middleware/server/exception_handler.rb
kulesa-sidekiq-1.2.2 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-1.2.1 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-1.2.0 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-1.1.4 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-1.1.3 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-1.1.2 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-1.1.1 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-1.1.0 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-1.0.0 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-0.11.2 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-0.11.1 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-0.11.0 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-0.10.1 lib/sidekiq/middleware/server/exception_handler.rb
sidekiq-0.10.0 lib/sidekiq/middleware/server/exception_handler.rb