diff --git a/include/continuable/detail/base.hpp b/include/continuable/detail/base.hpp index c26d1cf..f720717 100644 --- a/include/continuable/detail/base.hpp +++ b/include/continuable/detail/base.hpp @@ -334,22 +334,24 @@ struct error_callback, Callback, Executor, /// The operator which is called when an error occurred void operator()(types::dispatch_error_tag /*tag*/, types::error_type error) { - auto invoker = [] {}; + /* + *TODO + *auto invoker = [] {}; // Forward the error to the error handler packed_dispatch(std::move(executor_), std::move(invoker), std::move(callback_), std::move(next_callback_), - std::move(error)); + std::move(error));*/ } /// Resolves the continuation with the given values void set_value(Args... args) { - std::move(next_callback_)(std::move(args)...); + // std::move(next_callback_)(std::move(args)...); } /// Resolves the continuation with the given error variable. void set_exception(types::error_type error) { - std::move(next_callback_)(types::dispatch_error_tag{}, std::move(error)); + // std::move(next_callback_)(types::dispatch_error_tag{}, std::move(error)); } }; @@ -357,11 +359,11 @@ struct error_callback, Callback, Executor, /// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64095 struct empty_callback { template - void operator()(Args... /*error*/) const { + void operator()(Args... /*args*/) { } template - void set_value(Args... /*error*/) { + void set_value(Args... /*args*/) { } void set_exception(types::error_type /*error*/) { @@ -461,29 +463,18 @@ auto chain_error_handler(Continuation&& continuation, Callback&& callback, continuation = std::forward(continuation), callback = std::forward(callback), executor = std::forward(executor) - ](auto&& /*next_callback*/) mutable { - // Invokes a continuation with a given callback. - // Passes the next callback to the resulting continuable or - // invokes the next callback directly if possible. - // - // For example given: - // - Continuation: continuation<[](auto&& callback) { callback("hi"); - // }> - // - Callback: [](std::string) { } - // - NextCallback: []() { } - /*using Hint = decltype(hint_of(traits::identity_of(continuation))); - callbacks::result_callback, - std::decay_t, - std::decay_t> - proxy{std::move(partial_callable), std::move(executor), - std::forward(next_callback)};*/ + ](auto&& next_callback) mutable { - // Invoke the continuation with a proxy callback. - // The proxy callback is responsible for passing - // the result to the callback as well as decorating it. - /*attorney::invoke_continuation(std::forward(continuation), - std::move(proxy));*/ + using Hint = decltype(hint_of(traits::identity_of(continuation))); + callbacks::error_callback, + std::decay_t, + std::decay_t> + proxy{std::move(callback), std::move(executor), + std::forward(next_callback)}; + + attorney::invoke_continuation(std::move(continuation), + std::move(proxy)); }, hint, ownership_); } diff --git a/test/playground/test-playground.cpp b/test/playground/test-playground.cpp index 33fa437..41cd795 100644 --- a/test/playground/test-playground.cpp +++ b/test/playground/test-playground.cpp @@ -46,17 +46,17 @@ int main(int, char**) { .then([](std::string /*response*/) { // ... }) - .catching([](std::exception_ptr /*e*/) { + /*.catching([](std::exception_ptr) { // ... - }); + })*/; http_request2("github.com") .then([](std::string /*response*/) { // ... }) - .catching([](std::exception_ptr /*e*/) { + /*.catching([](std::exception_ptr) { // ... - }); + })*/; return 0; }