[CSHARP-1106] Review driver exception hierarchy Created: 17/Nov/14  Updated: 02/Apr/15  Resolved: 01/Dec/14

Status: Closed
Project: C# Driver
Component/s: None
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

Issue Links:
Depends
is depended on by CSHARP-1097 Add ConnectionId to MongoException (o... Closed
Related
related to CSHARP-1134 Add Mongo prefix to exception class n... Closed
Backwards Compatibility: Major Change

 Description   

We want to add a ConnectionId to exceptions somewhere (see CSHARP-1097), but MongoException doesn't seem to be the right place because not all subclasses of MongoException are connection related exceptions.

We need to review the driver exception hierarchy. Perhaps something like:

  • MongoException
    • MongoConnectionException (base class for all connection related exceptions)
    • other exceptions

In any case, it seems like the entire driver exception hierarchy needs to be revisited.



 Comments   
Comment by Robert Stam [ 01/Dec/14 ]

The commit messsage for this commit had a typo and mentioned the wrong JIRA ticket. This commit is for CSHARP-1106.

Author:

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

Message: CSHARP-1066: Make all exceptions fully serializable.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/7c882c4ff68bedd74b5dc1ac1247c91f922aa6d1

Comment by Githook User [ 26/Nov/14 ]

Author:

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

Message: CSHARP-1106: Add Mongo prefix to all exceptions.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/d2e0c37de72217922f282cc2cbaf5bb25d3af2c0

Comment by Githook User [ 25/Nov/14 ]

Author:

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

Message: CSHARP-1106: Added MongoCursorNotFoundException, MongoIncompatibleDriverException and MongoWaitQueueFullException.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/aff4c078ff3535f41c962a4584835cb8da7887ca

Comment by Githook User [ 21/Nov/14 ]

Author:

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

Message: CSHARP-1106: Refactor exception class hierarchy.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/fe21f61be1d0fb111c4b1cadf8d4e11c801551f1

Comment by Robert Stam [ 21/Nov/14 ]

Initially we're just going to introduce some new classes in the hierarchy, but not rename any existing classes. All existing classes will continue to derive from the same base exception as before, but there may be an additional new base class between them.

Exception
    MongoException
        MongoClientException
            ConfigurationException
        MongoConnectionException
            MessageNotSentException
            MongoAuthenticationException
        MongoInternalException
        MongoServerException
            BulkWriteException
            BulkWriteOperationException
            ExecutionTimeoutException
            MongoCommandException
                WriteConcernException
                    MongoDuplicateKeyException
            MongoGridFSException
            MongoQueryException
            NodeIsRecoveringException
            NotMasterException
            WriteException
            WriteProtocolException

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