From 91a8fcbe4360bd695be47bfa65cccbcc7a3a336a Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 26 Apr 2023 19:18:00 -0700 Subject: [PATCH] ircd::ctx::future: Add what() exception peeking convenience to interface. --- include/ircd/ctx/future.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/ircd/ctx/future.h b/include/ircd/ctx/future.h index 263a22c8b..8d031c161 100644 --- a/include/ircd/ctx/future.h +++ b/include/ircd/ctx/future.h @@ -46,6 +46,8 @@ struct ircd::ctx::future bool valid() const { return !is(state(), future_state::INVALID); } bool operator!() const { return !valid(); } + std::exception_ptr eptr() const { return state().eptr; } + string_view what() const { return util::what(eptr()); } explicit operator T() { return get(); } template friend bool wait_until(const future &, const time_point &, std::nothrow_t); @@ -75,6 +77,8 @@ struct ircd::ctx::future bool valid() const { return !is(state(), future_state::INVALID); } bool operator!() const { return !valid(); } + std::exception_ptr eptr() const { return state().eptr; } + string_view what() const { return util::what(eptr()); } template friend bool wait_until(const future &, const time_point &, std::nothrow_t); template friend void wait_until(const future &, const time_point &);