minor: better error message for DB#command

This commit is contained in:
Kyle Banker 2010-07-12 14:33:52 -04:00
parent 86c50a0555
commit a00fb21d37
1 changed files with 3 additions and 1 deletions

View File

@ -466,7 +466,9 @@ module Mongo
result = Cursor.new(system_command_collection,
:limit => -1, :selector => selector, :socket => sock).next_document
if result.nil? || (check_response && !ok?(result))
if result.nil?
raise OperationFailure, "Database command '#{selector.keys.first}' failed: returned null."
elsif (check_response && !ok?(result))
raise OperationFailure, "Database command '#{selector.keys.first}' failed: #{result.inspect}"
else
result