summaryrefslogtreecommitdiff
path: root/s/strategy.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-12-29 00:52:03 -0500
committerEliot Horowitz <eliot@10gen.com>2010-12-29 00:52:03 -0500
commit82cf5dc7a96755b54108ae84473815702d5cc573 (patch)
treebce8c3a0059b01919bfa9e5d51477ef470d45c58 /s/strategy.cpp
parenta4267c0b9bb3007600c9992b54c72a895a53ab2d (diff)
downloadmongo-82cf5dc7a96755b54108ae84473815702d5cc573.tar.gz
fix exception handling in mongos
Diffstat (limited to 's/strategy.cpp')
-rw-r--r--s/strategy.cpp33
1 files changed, 13 insertions, 20 deletions
diff --git a/s/strategy.cpp b/s/strategy.cpp
index e3f1407f4c9..8017a7f51f1 100644
--- a/s/strategy.cpp
+++ b/s/strategy.cpp
@@ -45,31 +45,24 @@ namespace mongo {
}
void Strategy::doQuery( Request& r , const Shard& shard ){
- try{
- ShardConnection dbcon( shard , r.getns() );
- DBClientBase &c = dbcon.conn();
-
- Message response;
- bool ok = c.call( r.m(), response);
-
- {
- QueryResult *qr = (QueryResult *) response.singleData();
+
+ ShardConnection dbcon( shard , r.getns() );
+ DBClientBase &c = dbcon.conn();
+
+ Message response;
+ bool ok = c.call( r.m(), response);
+ uassert( 10200 , "mongos: error calling db", ok );
+
+ {
+ QueryResult *qr = (QueryResult *) response.singleData();
if ( qr->resultFlags() & ResultFlag_ShardConfigStale ){
dbcon.done();
throw StaleConfigException( r.getns() , "Strategy::doQuery" );
}
- }
-
- uassert( 10200 , "mongos: error calling db", ok);
- r.reply( response , c.getServerAddress() );
- dbcon.done();
- }
- catch ( AssertionException& e ) {
- BSONObjBuilder err;
- e.getInfo().append( err );
- BSONObj errObj = err.done();
- replyToQuery(ResultFlag_ErrSet, r.p() , r.m() , errObj);
}
+
+ r.reply( response , c.getServerAddress() );
+ dbcon.done();
}
void Strategy::insert( const Shard& shard , const char * ns , const BSONObj& obj ){