Permalink
Browse files

better error messages on network errors

  • Loading branch information...
1 parent 5350cd1 commit 1110b4270418986fabfeffa80c8cb37eee424059 @erh erh committed Oct 29, 2010
Showing with 3 additions and 4 deletions.
  1. +2 −2 client/dbclient.cpp
  2. +1 −2 client/dbclient.h
View
@@ -478,7 +478,7 @@ namespace mongo {
auto_ptr<DBClientCursor> c =
this->query(ns, query, 1, 0, fieldsToReturn, queryOptions);
- uassert( 10276 , "DBClientBase::findOne: transport error", c.get() );
+ uassert( 10276 , str::stream() << "DBClientBase::findOne: transport error: " << getServerAddress() , c.get() );
if ( c->hasResultFlag( ResultFlag_ShardConfigStale ) )
throw StaleConfigException( ns , "findOne has stale config" );
@@ -842,7 +842,7 @@ namespace mongo {
if ( !port().call(toSend, response) ) {
failed = true;
if ( assertOk )
- uassert( 10278 , "dbclient error communicating with server", false);
+ uasserted( 10278 , str::stream() << "dbclient error communicating with server: " << getServerAddress() );
return false;
}
}
View
@@ -332,8 +332,6 @@ namespace mongo {
/* used by QueryOption_Exhaust. To use that your subclass must implement this. */
virtual void recv( Message& m ) { assert(false); }
-
- virtual string getServerAddress() const = 0;
};
/**
@@ -363,6 +361,7 @@ namespace mongo {
*/
virtual BSONObj findOne(const string &ns, const Query& query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0);
+ virtual string getServerAddress() const = 0;
};

0 comments on commit 1110b42

Please sign in to comment.