Skip to content

Commit

Permalink
match "ERR wrong number of arguments for \'auth\' command" in Client.…
Browse files Browse the repository at this point in the history
…connect rescue CommandError
  • Loading branch information
verajohne committed Sep 7, 2021
1 parent 688ac95 commit 17ba094
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/redis/client.rb
Expand Up @@ -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]
Expand Down

0 comments on commit 17ba094

Please sign in to comment.