I'm catching errors in Boost Asio program like
if (!error)
{
//do stuff
}
else
{
std::cout << "Error : " << error << std::endl;
//handle error
}
But the error isn't human-readable (e.g. connecting to SSL server without certificate gives error asio.ssl:335544539). Is there any better way how to display error ?
If you are likely using boost::system::error_code
you can call:
error.message()
to get a more human-friendly message.
Using operator<<
translates into:
os << ec.category().name() << ':' << ec.value()
Here you can check a detailed overview of the available members in error_code
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With