diff --git a/examples/asio-cl.cc b/examples/asio-cl.cc index b8908265..a96de1c2 100644 --- a/examples/asio-cl.cc +++ b/examples/asio-cl.cc @@ -103,8 +103,8 @@ int main(int argc, char *argv[]) { }); }); - sess.on_error([](const std::string &error) { - std::cerr << "error: " << error << std::endl; + sess.on_error([](const boost::system::error_code &ec) { + std::cerr << "error: " << ec.message() << std::endl; }); io_service.run(); diff --git a/src/asio_client_session_impl.cc b/src/asio_client_session_impl.cc index 58985380..cf7c049d 100644 --- a/src/asio_client_session_impl.cc +++ b/src/asio_client_session_impl.cc @@ -91,7 +91,7 @@ void session_impl::connected() { void session_impl::not_connected(const boost::system::error_code &ec) { auto &error_cb = on_error(); if (error_cb) { - error_cb(ec.message()); + error_cb(ec); } } @@ -307,7 +307,7 @@ bool session_impl::setup_session() { if (rv != 0) { auto &error_cb = on_error(); if (error_cb) { - error_cb(nghttp2_strerror(rv)); + error_cb(make_error_code(static_cast(rv))); } return false; } diff --git a/src/includes/nghttp2/asio_http2.h b/src/includes/nghttp2/asio_http2.h index 8c2a8033..6a2d7d82 100644 --- a/src/includes/nghttp2/asio_http2.h +++ b/src/includes/nghttp2/asio_http2.h @@ -76,7 +76,7 @@ const boost::system::error_category &nghttp2_category() noexcept; typedef std::function data_cb; typedef std::function void_cb; -typedef std::function error_cb; +typedef std::function error_cb; typedef std::function close_cb; // Callback function to generate response body. The implementation of