diff options
author | Dorothy Chen <dorothy.chen@mongodb.com> | 2016-08-23 15:42:00 -0400 |
---|---|---|
committer | Dorothy Chen <dorothy.chen@mongodb.com> | 2016-08-26 15:14:07 -0400 |
commit | 6f03bed78373f186632f8d6f8a2d4fdc3e5177ee (patch) | |
tree | 38e3fcb1742cbf449065d2f0ff52f10f680971bd /src/mongo/db/commands/index_filter_commands.cpp | |
parent | cac902c5ea7f4f01db6826eb3a0ed32083fd6dac (diff) | |
download | mongo-6f03bed78373f186632f8d6f8a2d4fdc3e5177ee.tar.gz |
SERVER-23501 include stringified error code in erroring command replies
Diffstat (limited to 'src/mongo/db/commands/index_filter_commands.cpp')
-rw-r--r-- | src/mongo/db/commands/index_filter_commands.cpp | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/src/mongo/db/commands/index_filter_commands.cpp b/src/mongo/db/commands/index_filter_commands.cpp index 04a826b28d3..5a8b98f4390 100644 --- a/src/mongo/db/commands/index_filter_commands.cpp +++ b/src/mongo/db/commands/index_filter_commands.cpp @@ -58,20 +58,6 @@ using std::vector; using namespace mongo; /** - * Utility function to extract error code and message from status - * and append to BSON results. - */ -void addStatus(const Status& status, BSONObjBuilder& builder) { - builder.append("ok", status.isOK() ? 1.0 : 0.0); - if (!status.isOK()) { - builder.append("code", status.code()); - } - if (!status.reason().empty()) { - builder.append("errmsg", status.reason()); - } -} - -/** * Retrieves a collection's query settings and plan cache from the database. */ static Status getQuerySettingsAndPlanCache(OperationContext* txn, @@ -135,15 +121,8 @@ bool IndexFilterCommand::run(OperationContext* txn, string& errmsg, BSONObjBuilder& result) { string ns = parseNs(dbname, cmdObj); - Status status = runIndexFilterCommand(txn, ns, cmdObj, &result); - - if (!status.isOK()) { - addStatus(status, result); - return false; - } - - return true; + return appendCommandStatus(result, status); } |