From f961339cf5b9faf4a135b0cb613360ed8a737824 Mon Sep 17 00:00:00 2001 From: Jim Menard Date: Tue, 9 Dec 2008 14:47:34 -0500 Subject: [PATCH] Raise an error if cursor returns $err. --- lib/mongo/cursor.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/mongo/cursor.rb b/lib/mongo/cursor.rb index 0ea1b07..329fb5c 100644 --- a/lib/mongo/cursor.rb +++ b/lib/mongo/cursor.rb @@ -39,7 +39,9 @@ module XGen def next_object refill_via_get_more if num_remaining == 0 - @objects.shift + o = @objects.shift + raise o['$err'] if o['$err'] + o end def each