Project: ArangoDB (App Definition and Development / Database)
File: map.md

+++ title = "Approximate map between error code designs" weight = 10 +++ Much of the design of Boost.System (which went on to become `<system_error>`) has been retained in proposed `<system_error2>`, so an approximate map between `<systemerror2>` and `<systemerror>` and Boost.System can be given: <table width="100%" cellpadding="5" border="1"> <colgroup> <col width="25%"> <col width="25%"> <col width="50%"> </colgroup> <tr><th>C++ 17 <tt>&lt;systemerror&gt;</tt><th>Boost.System<th>Proposed <tt>&lt;systemerror2&gt;</tt> <tr> <td style="vertical-align: top;"><tt>std::errc</tt> <td style="vertical-align: top;"><tt>boost::system::errc</tt> <td style="vertical-align: top;"><tt>experimental::errc</tt> (almost identical) <tr> <td style="vertical-align: top;"><tt>std::error_category</tt> <td style="vertical-align: top;"><tt>boost::system::error_category</tt> <td style="vertical-align: top;"><tt>experimental::statuscodedomain</tt> <tr> <td style="vertical-align: top;"><tt>std::generic_category</tt> <td style="vertical-align: top;"><tt>boost::system::generic_category</tt> <td style="vertical-align: top;"><tt>experimental::genericcodedomain</tt> <tr> <td style="vertical-align: top;"><tt>std::system_category</tt> <td style="vertical-align: top;"><tt>boost::system::system_category</tt> <td style="vertical-align: top;">One of:<ul> <li><tt>experimental::posixcodedomain</tt> (POSIX systems)<p> <li><tt>experimental::win32codedomain</tt> (Microsoft Windows)<p> <li><tt>experimental::ntcodedomain</tt> (Microsoft Windows) </ul> Note that there are more precanned code categories though they require additional header inclusions: <tt>comcode</tt>, <tt>getaddrinfocode</tt>. <tr> <td style="vertical-align: top;"><tt>std::error_condition</tt> <td style="vertical-align: top;"><tt>boost::system::error_condition</tt> <td style="vertical-align: top;"><b>No equivalent</b> (deliberately removed as hindsight proved it to be a design mistake leading to much confusing and hard to audit for correctness code) <tr> <td style="vertical-align: top;"><tt>std::error_code</tt> <td style="vertical-align: top;"><tt>boost::system::error_code</tt> <td style="vertical-align: top;">One of:<ul> <li><tt>experimental::status_code&lt;DomainType&gt;</tt><p> <li><tt>const experimental::status_code&lt;void&gt; &amp;</tt><p> <li><tt>experimental::statuscode&lt;erased&lt;intptrt&gt;&gt;</tt> (aliased to <tt>experimental::system_code</tt>)<p> <li><tt>experimental::erroredstatuscode&lt;DomainType&gt;</tt><p> <li><tt>const experimental::erroredstatuscode&lt;void&gt; &amp;</tt><p> <li><tt>experimental::erroredstatuscode&lt;erased&lt;intptr_t&gt;&gt;</tt> (aliased to <tt>experimental::error</tt>) </ul> The difference between status codes and errored status codes is that the latter are guaranteed to refer to a failure, whereas the former may refer to a success (including warnings and informationals). <tr> <td style="vertical-align: top;"><tt>std::system_error</tt> <td style="vertical-align: top;"><tt>boost::system::system_error</tt> <td style="vertical-align: top;">One of:<ul> <li><tt>const experimental::status_error&lt;void&gt; &amp;</tt><p> <li><tt>experimental::status_error&lt;DomainType&gt;</tt> </ul> </table> As is obvious from the above, in `<system_error2>` one must be much more specific and accurate with respect to intent and specification and desired semantics than with `<system_error>`. Much ambiguity and incorrectness which flies silently in `<system_error>` will refuse to compile in `<system_error2>`.