0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

safety and better error message

This commit is contained in:
Eliot Horowitz 2009-02-03 11:04:54 -05:00
parent 687c1f237e
commit 8e5a1a3edf
2 changed files with 5 additions and 1 deletions

View File

@ -37,7 +37,7 @@ namespace mongo {
DBClientConnection *c = new DBClientConnection();
if ( !c->connect(host.c_str(), errmsg) ) {
delete c;
uassert("dbconnectionpool: connect failed", false);
uassert( (string)"dbconnectionpool: connect failed" + host , false);
return 0;
}
return c;

View File

@ -62,6 +62,7 @@ namespace mongo {
DBClientConnection *_conn;
public:
DBClientConnection& conn() {
uassert( "did you call done already" , _conn );
return *_conn;
}
@ -81,6 +82,9 @@ namespace mongo {
Why? See note in the destructor below.
*/
void done() {
if ( ! _conn )
return;
if ( _conn->isFailed() )
kill();
else