Boost error codes human-readable description

boost, boost-asio, c++, error-handling

Solution

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`.

Problem

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 ?

Original source

Related problems