mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 08:42:34 +01:00
ircd::util: Add util to get what() from std::exception_ptr.
This commit is contained in:
parent
8c02823d49
commit
19e6db0a33
1 changed files with 21 additions and 0 deletions
|
@ -472,5 +472,26 @@ pointers(input_container&& ic,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Get what() from exception_ptr
|
||||||
|
///
|
||||||
|
inline ircd::string_view
|
||||||
|
what(const std::exception_ptr &eptr)
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(likely(eptr))
|
||||||
|
std::rethrow_exception(eptr);
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
catch(const std::exception &e)
|
||||||
|
{
|
||||||
|
return e.what();
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace util
|
} // namespace util
|
||||||
} // namespace ircd
|
} // namespace ircd
|
||||||
|
|
Loading…
Reference in a new issue