RUBY-206 handle wtimeout behavior on 1.7.3
This commit is contained in:
parent
a825500784
commit
6196c8728a
@ -387,6 +387,7 @@ module Mongo
|
||||
|
||||
if num_received == 1 && (error = docs[0]['err'] || docs[0]['errmsg'])
|
||||
close if error == "not master"
|
||||
error = "wtimeout" if error == "timeout"
|
||||
raise Mongo::OperationFailure, docs[0]['code'].to_s + ': ' + error
|
||||
end
|
||||
|
||||
|
@ -468,8 +468,12 @@ module Mongo
|
||||
raise MongoArgumentError, "DB#command requires an OrderedHash when hash contains multiple keys"
|
||||
end
|
||||
|
||||
result = Cursor.new(system_command_collection,
|
||||
:limit => -1, :selector => selector, :socket => sock).next_document
|
||||
begin
|
||||
result = Cursor.new(system_command_collection,
|
||||
:limit => -1, :selector => selector, :socket => sock).next_document
|
||||
rescue OperationFailure => ex
|
||||
raise OperationFailure, "Database command '#{selector.keys.first}' failed: #{ex.message}"
|
||||
end
|
||||
|
||||
if result.nil?
|
||||
raise OperationFailure, "Database command '#{selector.keys.first}' failed: returned null."
|
||||
|
Loading…
Reference in New Issue
Block a user