Skip to content

Commit 6c5e3df

Browse files
authored
Merge pull request #144 from CoreyKaylor/fix-enumerable
Fix AsEnumerable silent failure
2 parents 2a8791b + b333309 commit 6c5e3df

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/LightningDB/LightningExtensions.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,12 @@ private static string mdb_strerror(int err)
6464
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6565
public static IEnumerable<ValueTuple<MDBValue, MDBValue>> AsEnumerable(this LightningCursor cursor)
6666
{
67-
do
67+
while(cursor.Next() == MDBResultCode.Success)
6868
{
6969
var (resultCode, key, value) = cursor.GetCurrent();
70-
if (resultCode == MDBResultCode.Success)
71-
{
72-
yield return (key, value);
73-
}
74-
} while (cursor.Next() == MDBResultCode.Success);
70+
resultCode.ThrowOnError();
71+
yield return (key, value);
72+
}
7573
}
7674

7775
/// <summary>

0 commit comments

Comments
 (0)