diff --git a/sources/builders/array_builder.cpp b/sources/builders/array_builder.cpp index e74baa53..7a9eeb4e 100644 --- a/sources/builders/array_builder.cpp +++ b/sources/builders/array_builder.cpp @@ -45,11 +45,12 @@ array_builder::fetch_array_size(std::string& buffer) { int64_t size = m_int_builder.get_integer(); if (size < 0) { - __CPP_REDIS_LOG(error, "cpp_redis::builders::array_builder receives invalid array size"); - throw redis_error("Invalid array size"); + m_reply.set(); + m_reply_ready = true; } - else if (size == 0) + else if (size == 0) { m_reply_ready = true; + } m_array_size = size; diff --git a/tests/sources/spec/builders/array_builder_spec.cpp b/tests/sources/spec/builders/array_builder_spec.cpp index b613b6c3..a2186a09 100644 --- a/tests/sources/spec/builders/array_builder_spec.cpp +++ b/tests/sources/spec/builders/array_builder_spec.cpp @@ -141,5 +141,11 @@ TEST(ArrayBuilder, InvalidSize) { cpp_redis::builders::array_builder builder; std::string buffer = "-1\r\n"; - EXPECT_THROW(builder << buffer, cpp_redis::redis_error); + builder << buffer; + + EXPECT_EQ(true, builder.reply_ready()); + EXPECT_EQ("", buffer); + + auto reply = builder.get_reply(); + EXPECT_TRUE(reply.is_null()); }