From: Kefu Chai Date: Wed, 23 Jun 2021 08:11:24 +0000 (+0800) Subject: crimson/common/errorator: consider return value as ready future in maybe_handle_error_t X-Git-Tag: v17.1.0~1577^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fd00aa96a4384b6a6581c6b26126d7ffbee6021a;p=ceph.git crimson/common/errorator: consider return value as ready future in maybe_handle_error_t this behavior mirrors seasetar::futurize::apply(), where non-future and non-void return values are converted to future<>, and returned instead. this change could simplify some use cases where we always return an immediately available future. Signed-off-by: Kefu Chai --- diff --git a/src/crimson/common/errorator.h b/src/crimson/common/errorator.h index 4a0f56a87d9b..4b1369900366 100644 --- a/src/crimson/common/errorator.h +++ b/src/crimson/common/errorator.h @@ -280,9 +280,9 @@ public: std::invoke(std::forward(errfunc), ErrorT::error_t::from_exception_ptr(std::move(ep))); } else { - static_assert(_impl::always_false::value, - "return of Error Visitor is not assignable to future"); - // do nothing with `ep`. + result = FuturatorT::type::errorator_type::template make_ready_future( + std::invoke(std::forward(errfunc), + ErrorT::error_t::from_exception_ptr(std::move(ep)))); } } }