diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-10-29 00:49:08 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-10-29 00:49:08 -0400 |
commit | 1110b4270418986fabfeffa80c8cb37eee424059 (patch) | |
tree | 423b660e81db4822f9d2f4d451a463e641b93ee3 /client | |
parent | 5350cd1b36c36be2a62755f32b340006d5430883 (diff) | |
download | mongo-1110b4270418986fabfeffa80c8cb37eee424059.tar.gz |
better error messages on network errors
Diffstat (limited to 'client')
-rw-r--r-- | client/dbclient.cpp | 4 | ||||
-rw-r--r-- | client/dbclient.h | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/client/dbclient.cpp b/client/dbclient.cpp index 41b75985bfe..828e4d05c33 100644 --- a/client/dbclient.cpp +++ b/client/dbclient.cpp @@ -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; } } diff --git a/client/dbclient.h b/client/dbclient.h index eaa63944423..8598ae2e32a 100644 --- a/client/dbclient.h +++ b/client/dbclient.h @@ -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; }; |