Removed request body from some error responses in quota handler.

When an error is not related to the whole request (e.g., parsing,
converting to protobuf), but to its part (e.g., unknown role), it
seems unnecessary to include the complete request body into the
error response.

Review: https://reviews.apache.org/r/46033/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/7d9a5b56
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/7d9a5b56
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/7d9a5b56

Branch: refs/heads/master
Commit: 7d9a5b56414d15e66a2073ed4dc5e8fb39be1976
Parents: e10814f
Author: Alexander Rukletsov <ruklet...@gmail.com>
Authored: Mon Apr 11 17:21:47 2016 +0200
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Mon Apr 11 17:21:47 2016 +0200

----------------------------------------------------------------------
 src/master/quota_handler.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7d9a5b56/src/master/quota_handler.cpp
----------------------------------------------------------------------
diff --git a/src/master/quota_handler.cpp b/src/master/quota_handler.cpp
index 88247d6..cfa38f9 100644
--- a/src/master/quota_handler.cpp
+++ b/src/master/quota_handler.cpp
@@ -254,16 +254,16 @@ Future<http::Response> Master::QuotaHandler::set(
   // Check that the role is on the role whitelist, if it exists.
   if (!master->isWhitelistedRole(quotaInfo.role())) {
     return BadRequest(
-        "Failed to validate set quota request JSON '" + request.body +
-        "': Unknown role '" + quotaInfo.role() + "'");
+        "Failed to validate set quota request JSON: Unknown role '" +
+        quotaInfo.role() + "'");
   }
 
   // Check that we are not updating an existing quota.
   // TODO(joerg84): Update error message once quota update is in place.
   if (master->quotas.contains(quotaInfo.role())) {
     return BadRequest(
-        "Failed to validate set quota request JSON '" + request.body +
-        "': Can not set quota for a role that already has quota");
+        "Failed to validate set quota request JSON: Can not set quota"
+        " for role '" + quotaInfo.role() + "' which already has quota");
   }
 
   // The force flag is used to overwrite the `capacityHeuristic` check.

Reply via email to