2
0
mirror of https://github.com/boostorg/leaf.git synced 2026-02-22 15:32:24 +00:00

Improved diagnostic_details, able to access error objects from parent error handling scopes

This commit is contained in:
Emil Dotchevski
2026-02-10 15:07:46 -05:00
parent f3ac5509d4
commit 36a28472f3
9 changed files with 303 additions and 87 deletions

View File

@@ -52,6 +52,24 @@ enum class my_error_code
error3
};
class my_error_code_category: public std::error_category
{
public:
char const * name() const noexcept override { return "my_error_code"; }
std::string message(int) const override { return "my_error_code"; }
};
my_error_code_category const & get_my_error_code_category()
{
static my_error_code_category cat;
return cat;
}
std::error_code make_error_code(my_error_code e)
{
return std::error_code(static_cast<int>(e), get_my_error_code_category());
}
namespace std
{
template <> struct is_error_code_enum<my_error_code>: std::true_type { };