Skip to content

Commit

Permalink
Add a workaround for Microsoft's non-conformant std::system_error.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskohlhoff committed Sep 18, 2013
1 parent 383b05e commit d7228f4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions asio/boostify.pl
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,13 @@ sub copy_source_file
last if $line =~ /boostify: non-boost docs end here/;
}
}
elsif ($line =~ /boostify: non-boost code starts here/)
{
while ($line = <$input>)
{
last if $line =~ /boostify: non-boost code ends here/;
}
}
elsif ($line =~ /^$/ && $needs_doc_link)
{
$needs_doc_link = 0;
Expand Down
15 changes: 15 additions & 0 deletions asio/include/asio/detail/impl/throw_error.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,23 @@ void do_throw_error(const asio::error_code& err)

void do_throw_error(const asio::error_code& err, const char* location)
{
// boostify: non-boost code starts here
#if defined(ASIO_MSVC) && defined(ASIO_HAS_STD_SYSTEM_ERROR)
// Microsoft's implementation of std::system_error is non-conformant in that
// it ignores the error code's message when a "what" string is supplied. We'll
// work around this by explicitly formatting the "what" string.
std::string what_msg = location;
what_msg += ": ";
what_msg += err.message();
asio::system_error e(err, what_msg);
asio::detail::throw_exception(e);
#else // defined(ASIO_MSVC) && defined(ASIO_HAS_STD_SYSTEM_ERROR)
// boostify: non-boost code ends here
asio::system_error e(err, location);
asio::detail::throw_exception(e);
// boostify: non-boost code starts here
#endif // defined(ASIO_MSVC) && defined(ASIO_HAS_STD_SYSTEM_ERROR)
// boostify: non-boost code ends here
}

} // namespace detail
Expand Down

0 comments on commit d7228f4

Please sign in to comment.