chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.97k stars 1.22k forks source link

Error traits #1514

Closed klemens-morgenstern closed 2 weeks ago

klemens-morgenstern commented 3 months ago

Other errors may be used by libraries (e.g. mysql or redis) to add more refined information. Supporting turning those into exceptions by default is however a requirement if library authors want a void(my_error, ...) completion signature.

anarthal commented 3 months ago

This has been an absolute pain in Boost.MySQL, where getting error information provided by the server is really important for users. We created extra overloads for such information, but interoperability with Asio suffers. This PR would really address this need.

klemens-morgenstern commented 2 weeks ago

Added as disposition in ecaa507b1b56484554ebc0cbcd300a483cf9a2e9.

Thanks Chris!

anarthal commented 2 weeks ago

If the error type must be nothrow copy constructible, this is not a solution to neither Boost.MySQL nor Boost.Redis problems, as these use std::string for additional info.

zhscn commented 1 week ago

Can we relax the restrictions and use is_nothrow_move_constructible?