Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Preserve ASIO errors if possible #652

Merged
merged 2 commits into from
Sep 24, 2017
Merged

Conversation

vadz
Copy link
Contributor

@vadz vadz commented Jun 3, 2017

This allows to give meaningful error messages when connection fails (at least when using compatible ASIO and system::error_code, see also #651).

These methods don't need any object to operate on, so make them static to
allow calling them without an actual connection object at hand.
@vadz vadz force-pushed the preserve-asio-errors branch from d704409 to 94afce9 Compare June 4, 2017 14:49
This was already done in asio::xxx_socket::connection methods by using
translate_ec() which allowed to preserve the error code when possible (i.e.
when using Boost.ASIO with Boost.System or standalone ASIO with C++11
std::error_code), but errors also can happen in endpoint methods such as
handle_connect(), where they were totally lost and replaced with a rather
useless error::pass_through.

With these changes, the real error codes are preserved and applications using
the library can give more useful error messages if connection fails.
@vadz vadz force-pushed the preserve-asio-errors branch from 94afce9 to 81ef065 Compare June 4, 2017 14:50
@zaphoyd zaphoyd merged commit 88de392 into zaphoyd:develop Sep 24, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants