From: Radoslaw Zarzynski Date: Sun, 15 Sep 2019 15:17:45 +0000 (+0200) Subject: crimson: introduce all_same_way() to errorator. X-Git-Tag: v15.1.0~801^2~29 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=de325ade55e23856439d30abda4b0205252dda66;p=ceph.git crimson: introduce all_same_way() to errorator. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/crimson/common/errorator.h b/src/crimson/common/errorator.h index 55710106341f..0cc06ea1887e 100644 --- a/src/crimson/common/errorator.h +++ b/src/crimson/common/errorator.h @@ -412,6 +412,18 @@ struct errorator { } }; + template + static decltype(auto) all_same_way(ErrorFunc&& error_func) { + return [ + error_func = std::forward(error_func) + ] (auto&& e) mutable -> decltype(auto) { + using decayed_t = std::decay_t; + auto&& handler = + decayed_t::error_t::handle(std::forward(error_func)); + return std::invoke(std::move(handler), std::forward(e)); + }; + }; + // get a new errorator by extending current one with new error template using extend = errorator;