Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Merge e12ccee into 2d92a6b
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhyman committed Sep 4, 2014
2 parents 2d92a6b + e12ccee commit 4236bca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/moped/authenticatable.rb
Expand Up @@ -71,7 +71,14 @@ def login(database, username, password)
self.write([ authenticate ])
document = self.read.documents.first

raise Errors::AuthenticationFailure.new(authenticate, document) unless document["ok"] == 1
unless document["ok"] == 1
# It may be the case that there are socket errors when trying to connect to the host
reconfig = Errors::PotentialReconfiguration.new(authenticate, document)
if reconfig.reconfiguring_replica_set? || reconfig.connection_failure?
raise reconfig
end
raise Errors::AuthenticationFailure.new(authenticate, document)
end
credentials[database] = [username, password]
end

Expand Down
2 changes: 1 addition & 1 deletion lib/moped/errors.rb
Expand Up @@ -115,7 +115,7 @@ class PotentialReconfiguration < MongoError
NOT_MASTER = [ 13435, 13436, 10009 ]

# Error codes received around reconfiguration
CONNECTION_ERRORS_RECONFIGURATION = [ 15988, 10276, 11600, 9001, 13639, 10009 ]
CONNECTION_ERRORS_RECONFIGURATION = [ 15988, 10276, 11600, 9001, 13639, 10009, 11002 ]

# Replica set reconfigurations can be either in the form of an operation
# error with code 13435, or with an error message stating the server is
Expand Down

0 comments on commit 4236bca

Please sign in to comment.