Sha256: 6f5e1c83f4b6790aa72b9013ca4b96f4ea73e1b3c7e5f81ac393ab3359f349f4

Contents?: true

Size: 621 Bytes

Versions: 12

Compression:

Stored size: 621 Bytes

Contents

module WatCatcher
  class SidekiqMiddleware
    def call(worker, msg, queue)
      begin
        yield
      rescue => excpt
        raise if thrown_by_watcatcher?(msg)
        u = nil
        begin
          if worker.class == Sidekiq::Extensions::DelayedClass
            (worker,method_name,args) = YAML.load(msg["args"][0])
          end
          u = worker.wat_user(*msg["args"]) if worker.respond_to? :wat_user
        rescue; end
        WatCatcher::Report.new(excpt, user: u, sidekiq: msg)
        raise
      end
    end

    def thrown_by_watcatcher?(msg)
      msg["class"] =~ /WatCatcher/
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
wat_catcher-0.8.3 lib/wat_catcher/sidekiq_middleware.rb
wat_catcher-0.8.2 lib/wat_catcher/sidekiq_middleware.rb
wat_catcher-0.8.1 lib/wat_catcher/sidekiq_middleware.rb
wat_catcher-0.8.0 lib/wat_catcher/sidekiq_middleware.rb
wat_catcher-0.7.2 lib/wat_catcher/sidekiq_middleware.rb
wat_catcher-0.7.1 lib/wat_catcher/sidekiq_middleware.rb
wat_catcher-0.7.0 lib/wat_catcher/sidekiq_middleware.rb
wat_catcher-0.6.0 lib/wat_catcher/sidekiq_middleware.rb
wat_catcher-0.5.5 lib/wat_catcher/sidekiq_middleware.rb
wat_catcher-0.5.4 lib/wat_catcher/sidekiq_middleware.rb
wat_catcher-0.5.3 lib/wat_catcher/sidekiq_middleware.rb
wat_catcher-0.5.2 lib/wat_catcher/sidekiq_middleware.rb