close connection on exception on safe insert

This commit is contained in:
Kyle Banker 2010-10-29 17:52:15 -04:00
parent 0b0834eb91
commit 424f08af5e

View File

@ -424,6 +424,7 @@ module Mongo
checkin(sock)
end
if num_received == 1 && (error = docs[0]['err'] || docs[0]['errmsg'])
close
raise Mongo::OperationFailure, error
end
[docs, num_received, cursor_id]