summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/get_last_error.cpp
diff options
context:
space:
mode:
authorDorothy Chen <dorothy.chen@mongodb.com>2016-08-23 15:42:00 -0400
committerDorothy Chen <dorothy.chen@mongodb.com>2016-08-26 15:14:07 -0400
commit6f03bed78373f186632f8d6f8a2d4fdc3e5177ee (patch)
tree38e3fcb1742cbf449065d2f0ff52f10f680971bd /src/mongo/db/commands/get_last_error.cpp
parentcac902c5ea7f4f01db6826eb3a0ed32083fd6dac (diff)
downloadmongo-6f03bed78373f186632f8d6f8a2d4fdc3e5177ee.tar.gz
SERVER-23501 include stringified error code in erroring command replies
Diffstat (limited to 'src/mongo/db/commands/get_last_error.cpp')
-rw-r--r--src/mongo/db/commands/get_last_error.cpp4
1 files changed, 4 insertions, 0 deletions
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;
}