Details
-
Improvement
-
Resolution: Done
-
Major - P3
-
None
-
2.5.1
-
Sharding
Description
... since these calls can fail with a DBException on failure to connect, failure to auth (in authenticated systems), or failure to initShardVersion (for ShardConnections). Need to be careful about unintended exception codepaths, and these are hard to catch during testing since the failure depends on conn pooling.
For example:
ScopedDbConn conn(...);
|
Type result;
|
try {
|
result = conn->doSomething();
|
}
|
catch( const DBException& ex ){
|
...
|
}
|
done();
|
is not exception-safe. Should be:
Type result;
|
try {
|
ScopedDbConn conn(...);
|
result = conn.doSomething();
|
conn.done();
|
}
|
catch( const DBException& ex ) {
|
...
|
}
|