diff options
author | Mathias Stearn <mathias@10gen.com> | 2017-10-26 12:22:40 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2017-11-02 14:25:22 -0400 |
commit | 51ebfe7bb870a1665653ad8088b121706ce3d5b5 (patch) | |
tree | a436f2d691e897e7893eba461a68212407e3a31d /src/mongo/client/dbclient_rs.cpp | |
parent | cd26a1d5ee080f1a68b874046e5e5b3672267f69 (diff) | |
download | mongo-51ebfe7bb870a1665653ad8088b121706ce3d5b5.tar.gz |
SERVER-31734 Add Status::withContext() and addContext()
These prepend the message with a context string, leaving everything else alone.
Diffstat (limited to 'src/mongo/client/dbclient_rs.cpp')
-rw-r--r-- | src/mongo/client/dbclient_rs.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/mongo/client/dbclient_rs.cpp b/src/mongo/client/dbclient_rs.cpp index a4e7a5df146..10547fc66c1 100644 --- a/src/mongo/client/dbclient_rs.cpp +++ b/src/mongo/client/dbclient_rs.cpp @@ -540,10 +540,10 @@ unique_ptr<DBClientCursor> DBClientReplicaSet::query(const string& ns, return checkSlaveQueryResult(std::move(cursor)); } catch (const DBException& ex) { - const Status status = ex.toStatus(); - lastNodeErrMsg = str::stream() << "can't query replica set node " - << _lastSlaveOkHost << ": " << status.reason(); - _invalidateLastSlaveOkCache({status.code(), lastNodeErrMsg}); + const Status status = ex.toStatus(str::stream() << "can't query replica set node " + << _lastSlaveOkHost); + lastNodeErrMsg = status.reason(); + _invalidateLastSlaveOkCache(status); } } @@ -589,11 +589,10 @@ BSONObj DBClientReplicaSet::findOne(const string& ns, return conn->findOne(ns, query, fieldsToReturn, queryOptions); } catch (const DBException& ex) { - const Status status = ex.toStatus(); - lastNodeErrMsg = str::stream() << "can't findone replica set node " - << _lastSlaveOkHost.toString() << ": " - << status.reason(); - _invalidateLastSlaveOkCache({status.code(), lastNodeErrMsg}); + const Status status = ex.toStatus(str::stream() << "can't findone replica set node " + << _lastSlaveOkHost.toString()); + lastNodeErrMsg = status.reason(); + _invalidateLastSlaveOkCache(status); } } @@ -779,11 +778,11 @@ void DBClientReplicaSet::say(Message& toSend, bool isRetry, string* actualServer _lazyState._secondaryQueryOk = true; _lazyState._lastClient = conn; } catch (const DBException& ex) { - const Status status = ex.toStatus(); - lastNodeErrMsg = str::stream() << "can't callLazy replica set node " - << _lastSlaveOkHost.toString() << ": " - << status.reason(); - _invalidateLastSlaveOkCache({status.code(), lastNodeErrMsg}); + const Status status = + ex.toStatus(str::stream() << "can't callLazy replica set node " + << _lastSlaveOkHost.toString()); + lastNodeErrMsg = status.reason(); + _invalidateLastSlaveOkCache(status); continue; } |