#include <iostream>
#include <system_error>
int main()
{
std::error_condition econd = std::system_category().default_error_condition(EFAULT);
std::cout << "Category: " << econd.category().name() << '\n'
<< "Value: " << econd.value() << '\n'
<< "Message: " << econd.message() << '\n';
try
{
throw std::system_error( std::error_code(EFAULT, std::system_category()) );
}
catch (const std::system_error& error)
{
std::cout << "Error: " << error.code()
<< " - " << error.code().message()
<< ". Category: " << error.code().category().name()
<< '\n';
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3lzdGVtX2Vycm9yPgoKaW50IG1haW4oKQp7CgogICAgIHN0ZDo6ZXJyb3JfY29uZGl0aW9uIGVjb25kID0gc3RkOjpzeXN0ZW1fY2F0ZWdvcnkoKS5kZWZhdWx0X2Vycm9yX2NvbmRpdGlvbihFRkFVTFQpOwogICAgICBzdGQ6OmNvdXQgPDwgIkNhdGVnb3J5OiAiIDw8IGVjb25kLmNhdGVnb3J5KCkubmFtZSgpIDw8ICdcbicKICAgICAgICAgICAgICA8PCAiVmFsdWU6ICIgPDwgZWNvbmQudmFsdWUoKSA8PCAnXG4nCiAgICAgICAgICAgICAgPDwgIk1lc3NhZ2U6ICIgPDwgZWNvbmQubWVzc2FnZSgpIDw8ICdcbic7CgogICAgdHJ5CiAgICB7CiAgICAgICAgdGhyb3cgc3RkOjpzeXN0ZW1fZXJyb3IoIHN0ZDo6ZXJyb3JfY29kZShFRkFVTFQsIHN0ZDo6c3lzdGVtX2NhdGVnb3J5KCkpICk7CiAgICB9CiAgICBjYXRjaCAoY29uc3Qgc3RkOjpzeXN0ZW1fZXJyb3ImIGVycm9yKQogICAgewogICAgICAgIHN0ZDo6Y291dCA8PCAiRXJyb3I6ICIgPDwgZXJyb3IuY29kZSgpCiAgICAgICAgICAgICAgICAgIDw8ICIgLSAiIDw8IGVycm9yLmNvZGUoKS5tZXNzYWdlKCkKICAgICAgICAgICAgICAgICAgPDwgIi4gQ2F0ZWdvcnk6ICIgPDwgZXJyb3IuY29kZSgpLmNhdGVnb3J5KCkubmFtZSgpCiAgICAgICAgICAgICAgICAgICA8PCAnXG4nOwogICAgfQp9