Skip to content

Commit f535711

Browse files
author
rstam
committed
CSHARP-791: Ignore any exceptions thrown by KillCursor.
1 parent 03fd9b5 commit f535711

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

MongoDB.Driver/Operations/QueryOperation.cs

+8-10
Original file line numberDiff line numberDiff line change
@@ -115,20 +115,18 @@ public IEnumerator<TDocument> Execute(IConnectionProvider connectionProvider)
115115
}
116116
}
117117
}
118-
catch
119-
{
120-
if (reply != null && reply.CursorId != 0)
121-
{
122-
try { KillCursor(connectionProvider, reply.CursorId); }
123-
catch { } // ignore exceptions and rethrow the original exception
124-
}
125-
throw;
126-
}
127118
finally
128119
{
129120
if (reply != null && reply.CursorId != 0)
130121
{
131-
KillCursor(connectionProvider, reply.CursorId);
122+
try
123+
{
124+
KillCursor(connectionProvider, reply.CursorId);
125+
}
126+
catch
127+
{
128+
// don't throw any exceptions from the finally block
129+
}
132130
}
133131
}
134132
}

0 commit comments

Comments
 (0)