Skip to content

Commit

Permalink
Merge pull request #1025 from verajohne/rescue_command_error_match_me…
Browse files Browse the repository at this point in the history
…ssage

match appropriate error message in Client.connect rescue CommandError
  • Loading branch information
byroot committed Sep 23, 2021
2 parents a5fe658 + 17ba094 commit d9b9423
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 d9b9423

Please sign in to comment.