-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
Affects Version/s: 1.0
-
Component/s: Feature Request
-
None
-
Minor Change
I would like to suggest wrapping internal I/O exceptions in a custom exception (i.e. MongoCommunicationException).
Imagine the following scenario:
- I connect to a replica set and begin perform queries
- Suddenly, the server I was querying goes down and the NetworkStream.Read() throws IOException, which gets to my code
- I have no knowledge which exceptions could be thrown from the below code and if I should retry the operation (catching all types of exceptions, especially in a hosted environment is very risky, think ThreadAbortException for example).
But, if the connection management layer of the driver would wrap all I/O-related exceptions into one type of exceptions (a new one, MongoCommunicationException or even the existing one MongoConnectionException), the driver user would instantly know that there was a problem with MongoDB connection, not some fluke in his code, and retrying/reporting failure becomes much easier.
- is related to
-
CSHARP-474 Review all exceptions thrown by the C# driver
- Closed
- related to
-
CSHARP-155 Support for error codes in command results and exceptions
- Closed
-
CSHARP-393 MongoConnectionPool should throw some kind of MongoException (MongoConnectionException?) instead of TimeoutException
- Closed