Sha256: d650026c8171ae5840a600792883527e4226d8c734789b18d7c1228d5b2ddd7e

Contents?: true

Size: 536 Bytes

Versions: 9

Compression:

Stored size: 536 Bytes

Contents

module EMJack
  module Handler
    class Errors
      RESPONSE = /^(OUT_OF_MEMORY|INTERNAL_ERROR|DRAINING|BAD_FORMAT|UNKNOWN_COMMAND|EXPECTED_CRLF|JOB_TOO_BIG|DEADLINE_SOON|TIMED_OUT|NOT_FOUND)\r\n/i

      def self.handles?(response)
        response =~ RESPONSE
      end

      def self.handle(deferrable, response, body, conn=nil)
        return false unless response =~ RESPONSE
        deferrable.fail($1.downcase.to_sym)
        true
      end

      EMJack::Connection.register_handler(EMJack::Handler::Errors)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
em-jack-0.1.5 lib/em-jack/handlers/errors.rb
em-jack-0.1.4 lib/em-jack/handlers/errors.rb
em-jack-0.1.3 lib/em-jack/handlers/errors.rb
em-jack-0.1.2 lib/em-jack/handlers/errors.rb
em-jack-0.1.1 lib/em-jack/handlers/errors.rb
em-jack-0.1.0 lib/em-jack/handlers/errors.rb
em-jack-0.0.9 lib/em-jack/handlers/errors.rb
em-jack-0.0.8 lib/em-jack/handlers/errors.rb
em-jack-0.0.7 lib/em-jack/handlers/errors.rb