diff --git a/src/crimson/common/errorator.h b/src/crimson/common/errorator.h index 55710106341..0cc06ea1887 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;