-
Type: Improvement
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.0.0
-
Component/s: API, Documentation, Error Handling
-
None
I was under the impression that catching `MongoException` was sufficient for error handling driver calls to the database. In cases of network/mongo instability, I'm also seeing `IllegalStateExceptions` which is escaping our normal error handling.
Would it make sense to have all exceptions extend from `MongoException`? If not, is it possible to publicly document a definitive list of high-level exceptions that can come out of mongo driver calls that all applications are recommended to catch? Is that list limited to `MongoException` and `IllegalArgumentException`? If so, can we guarantee nothing new will be added that doesn't fit that classification or is it recommended for applications to catch `Exception`?
[java] Exception in thread "Thread-47745" java.lang.IllegalStateException: open [java] at org.bson.util.Assertions.isTrue(Assertions.java:36) [java] at com.mongodb.DBTCPConnector.releasePort(DBTCPConnector.java:413) [java] at com.mongodb.DBCollectionImpl.insert(DBCollectionImpl.java:198) [java] at com.mongodb.DBCollectionImpl.insert(DBCollectionImpl.java:167) [java] at com.mongodb.DBCollection.insert(DBCollection.java:161) [java] at com.xgen.svc.brs.dao.BlockStoreDao.saveBlocks(BlockStoreDao.java:234) ...
- is related to
-
JAVA-1581 Driver throws IllegalStateException unnecessarily
- Closed