From 17ba0947a253f8fa56d6b3e430fc1a4813bef9a2 Mon Sep 17 00:00:00 2001 From: Vera Gangeskar Johne Date: Tue, 7 Sep 2021 10:22:11 -0400 Subject: [PATCH] match "ERR wrong number of arguments for \'auth\' command" in Client.connect rescue CommandError --- lib/redis/client.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/redis/client.rb b/lib/redis/client.rb index 270eb11f4..d480020c6 100644 --- a/lib/redis/client.rb +++ b/lib/redis/client.rb @@ -119,8 +119,12 @@ def connect if username begin call [:auth, username, password] - rescue CommandError # Likely on Redis < 6 - call [:auth, password] + rescue CommandError => err # Likely on Redis < 6 + if err.message.match?(/ERR wrong number of arguments for \'auth\' command/) + call [:auth, password] + else + raise + end end else call [:auth, password]