0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

ircd::util: Add util to get what() from std::exception_ptr.

This commit is contained in:
Jason Volk 2018-03-08 08:23:50 -08:00
parent 8c02823d49
commit 19e6db0a33

View file

@ -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 ircd