summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands.h
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2018-04-24 16:58:23 -0400
committerMathias Stearn <mathias@10gen.com>2018-05-08 14:57:37 -0400
commit589af3820b00ed0b7ac26a84cfeed6554ab191f3 (patch)
treebb393adad8b1ca4f6f0e23c035141e829e3eeee6 /src/mongo/db/commands.h
parent98f28d452b9b330d6c1696d6d8207b582a5870fc (diff)
downloadmongo-589af3820b00ed0b7ac26a84cfeed6554ab191f3.tar.gz
SERVER-34628 Prep for removing appendCommandStatus
* Added appendCommandStatusNoThrow matching the current aCS behavior * Make appendCommandStatus call uassertStatusOK then aCS on success * Make the few places that need to not throw call aCSNT A following commit will completely remove appendCommandStatus. It is split out because that commit is fairly huge.
Diffstat (limited to 'src/mongo/db/commands.h')
-rw-r--r--src/mongo/db/commands.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h
index b0573ab3a97..1bb669945c8 100644
--- a/src/mongo/db/commands.h
+++ b/src/mongo/db/commands.h
@@ -90,12 +90,25 @@ struct CommandHelpers {
static Command* findCommand(StringData name);
- // Helper for setting errmsg and ok field in command result object.
- static void appendCommandStatus(BSONObjBuilder& result,
- bool ok,
- const std::string& errmsg = {});
+ /**
+ * Helper for setting errmsg and ok field in command result object.
+ *
+ * This should generally only be called from the command dispatch code or to finish off the
+ * result of serializing a reply BSONObj in the case when it isn't going directly into a real
+ * command reply to be returned to the user.
+ */
+ static void appendSimpleCommandStatus(BSONObjBuilder& result,
+ bool ok,
+ const std::string& errmsg = {});
+
+ /**
+ * Adds the status fields to command replies.
+ *
+ * Calling this inside of commands to produce their reply is now deprecated. Just throw instead.
+ */
+ static bool appendCommandStatusNoThrow(BSONObjBuilder& result, const Status& status);
- // @return s.isOK()
+ // About to be deleted
static bool appendCommandStatus(BSONObjBuilder& result, const Status& status);
/**