From 6f03bed78373f186632f8d6f8a2d4fdc3e5177ee Mon Sep 17 00:00:00 2001 From: Dorothy Chen Date: Tue, 23 Aug 2016 15:42:00 -0400 Subject: SERVER-23501 include stringified error code in erroring command replies --- src/mongo/db/commands/get_last_error.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/mongo/db/commands/get_last_error.cpp') diff --git a/src/mongo/db/commands/get_last_error.cpp b/src/mongo/db/commands/get_last_error.cpp index 899d081926d..e71dcf15210 100644 --- a/src/mongo/db/commands/get_last_error.cpp +++ b/src/mongo/db/commands/get_last_error.cpp @@ -250,6 +250,7 @@ public: if (electionId != OID()) { errmsg = "wElectionId passed but no replication active"; result.append("code", ErrorCodes::BadValue); + result.append("codeName", ErrorCodes::errorString(ErrorCodes::BadValue)); return false; } } else { @@ -258,6 +259,8 @@ public: << repl::getGlobalReplicationCoordinator()->getElectionId(); errmsg = "election occurred after write"; result.append("code", ErrorCodes::WriteConcernFailed); + result.append("codeName", + ErrorCodes::errorString(ErrorCodes::WriteConcernFailed)); return false; } } @@ -278,6 +281,7 @@ public: dassert(!status.isOK()); result.append("errmsg", "timed out waiting for slaves"); result.append("code", status.code()); + result.append("codeName", ErrorCodes::errorString(status.code())); return true; } -- cgit v1.2.1