Skip to content

Commit 0b1ff53

Browse files
committed
Update DBTCPConnector.java
We should catch the `MongoException` first. Otherwish, any `RuntimeException` (com.mongodb.MongoException$DuplicateKey for example) will cause connection closed.
1 parent 244b5a2 commit 0b1ff53

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/com/mongodb/DBTCPConnector.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ <T> T doOperation(final DB db, final DBPort port, final DBPort.Operation<T> oper
217217
port.checkAuth( db.getMongo() );
218218
return operation.execute();
219219
}
220+
catch ( MongoException re ){
221+
throw re;
222+
}
220223
catch ( IOException ioe ){
221224
_myPort.error(port, ioe);
222225
throw new MongoException.Network("Operation on server " + port.getAddress() + " failed" , ioe );

0 commit comments

Comments
 (0)