[CSHARP-1192] Wrap exceptions that occur during communication with a MongoCommunicationException Created: 13/Mar/15  Updated: 02/Apr/15  Resolved: 13/Mar/15

Status: Closed
Project: C# Driver
Component/s: Connectivity
Affects Version/s: None
Fix Version/s: 2.0

Type: Task Priority: Major - P3
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Major Change

 Description   

Wrap any exceptions that occur during communications in a MongoCommunicationException.

Except: any subclasses of SystemException. These exceptions are all runtime errors that aren't meant to be caught because there is usually nothing you can do about them.

This is backward breaking to any applications that are catching the unwrapped exceptions. They will now need to catch MongoConnectionException and examine the inner exception.



 Comments   
Comment by Githook User [ 20/Mar/15 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1192: When wrapping connection exceptions in a MongoConnectionException don't wrap ThreadAbortException, StackOverflowException or OutOfMemoryException.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/fdfbedc19174ea953b50b4a5276b4d5ae50a5ffa

Comment by Robert Stam [ 17/Mar/15 ]

We ended up wrapping all exceptions instead of excluding SystemException and its subclasses.

The main reason is that SocketException is a subclass of SystemException, and we definitely want to wrap SocketException. The second reason is that it is just too hard to come up with a comprehensive and accurate list of what to wrap and what not to wrap. It's just easier to wrap everything.

Comment by Githook User [ 13/Mar/15 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1192: Renamed MongoConnectionFailedException to MongoConnectionClosedException.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/97e125cde018784634491c4ede3161a3b53fd553

Comment by Githook User [ 13/Mar/15 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1192: Wrap some connection exceptions in a MongoConnectionException.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/ead6647edcb12b81fa567796cbaac34d25eae0f1

Generated at Wed Feb 07 21:38:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.