lib/aerospike/command/exists_command.rb in aerospike-2.11.0 vs lib/aerospike/command/exists_command.rb in aerospike-2.12.0

- old
+ new

@@ -41,16 +41,28 @@ # Read header. @conn.read(@data_buffer, MSG_TOTAL_HEADER_SIZE) result_code = @data_buffer.read(13).ord & 0xFF - if (result_code != 0) && (result_code != Aerospike::ResultCode::KEY_NOT_FOUND_ERROR) - raise Aerospike::Exceptions::Aerospike.new(result_code) + if result_code == 0 + @exists = true + return end - @exists = (result_code == 0) + if result_code == Aerospike::ResultCode::KEY_NOT_FOUND_ERROR + @exists = false + return + end - empty_socket + if result_code == Aerospike::ResultCode::FILTERED_OUT + if @policy.fail_on_filtered_out + raise Aerospike::Exceptions::Aerospike.new(result_code) + end + @exists = true + return + end + + raise Aerospike::Exceptions::Aerospike.new(result_code) end end # class end # module