Add a workaround for Microsoft's non-conformant std::system_error.
This commit is contained in:
parent
383b05ecc5
commit
d7228f4632
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user