From e8516147d2926631fed98a793606bcbb0e6db9e1 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Mon, 29 May 2017 19:08:21 +0200 Subject: [PATCH] rgw: honor custom rgw_err::message in Swift's error handling. Signed-off-by: Radoslaw Zarzynski --- src/rgw/rgw_common.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 02b807efc1e4..a644c62b6755 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -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; + } } } -- 2.47.3