summaryrefslogtreecommitdiff
path: root/src/mongo/rpc/write_concern_error_detail.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/rpc/write_concern_error_detail.cpp')
-rw-r--r--src/mongo/rpc/write_concern_error_detail.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/rpc/write_concern_error_detail.cpp b/src/mongo/rpc/write_concern_error_detail.cpp
index fcad013be5e..1b63898daeb 100644
--- a/src/mongo/rpc/write_concern_error_detail.cpp
+++ b/src/mongo/rpc/write_concern_error_detail.cpp
@@ -40,6 +40,7 @@ using std::string;
namespace {
const BSONField<int> errCode("code");
+const BSONField<string> errCodeName("codeName");
const BSONField<BSONObj> errInfo("errInfo");
const BSONField<string> errMessage("errmsg");
@@ -67,8 +68,10 @@ bool WriteConcernErrorDetail::isValid(string* errMsg) const {
BSONObj WriteConcernErrorDetail::toBSON() const {
BSONObjBuilder builder;
- if (_isErrCodeSet)
+ if (_isErrCodeSet) {
builder.append(errCode(), _errCode);
+ builder.append(errCodeName(), ErrorCodes::errorString(ErrorCodes::fromInt(_errCode)));
+ }
if (_isErrInfoSet)
builder.append(errInfo(), _errInfo);