]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: honor custom rgw_err::message in Swift's error handling.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Mon, 29 May 2017 17:08:21 +0000 (19:08 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 22 Aug 2017 13:19:30 +0000 (09:19 -0400)
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_common.cc

index 02b807efc1e4281da9362dff523ce39737032694..a644c62b675552fd88e409ab1b8e62140428b0dc 100644 (file)
@@ -341,7 +341,17 @@ void set_req_state_err(struct req_state* s, int err_no, const string& err_msg)
 {
   if (s) {
     set_req_state_err(s, err_no);
-    s->err.message = err_msg;
+    if (s->prot_flags & RGW_REST_SWIFT && !err_msg.empty()) {
+      /* TODO(rzarzynski): there never ever should be a check like this one.
+       * It's here only for the sake of the patch's backportability. Further
+       * commits will move the logic to a per-RGWHandler replacement of
+       * the end_header() function. Alternativaly, we might consider making
+       * that just for the dump(). Please take a look on @cbodley's comments
+       * in PR #10690 (https://github.com/ceph/ceph/pull/10690). */
+      s->err.err_code = err_msg;
+    } else {
+      s->err.message = err_msg;
+    }
   }
 }