From bc431b40135f2f95528c4c91f5a4ec584b3f8efa Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Sun, 1 Oct 2017 03:37:34 +0200 Subject: [PATCH] Rename catching -> fail --- include/continuable/continuable-base.hpp | 14 ++++++++------ include/continuable/continuable.hpp | 1 - test/playground/test-playground.cpp | 16 ++++++++++++---- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/include/continuable/continuable-base.hpp b/include/continuable/continuable-base.hpp index 25920f1..37e9434 100644 --- a/include/continuable/continuable-base.hpp +++ b/include/continuable/continuable-base.hpp @@ -227,16 +227,18 @@ public: } /// Main method of the continuable_base to catch exceptions and error codes + /// in case the asynchronous control flow failed and was resolved + /// through an error code or exception. /// /// \param callback The callback which is used to process the current /// asynchronous error result on arrival. - /// In case the continuable_base is using exceptions, the usage is as - /// shown below: + /// In case the continuable_base is using exceptions, + /// the usage is as shown below: /// /// ```cpp /// http_request("github.com") /// .then([](std::string github) { }) - /// .catching([](std::exception_ptr ptr) { + /// .fail([](std::exception_ptr ptr) { /// // Handle the error here /// try { /// std::rethrow_exception(ptr); @@ -250,7 +252,7 @@ public: /// ```cpp /// http_request("github.com") /// .then([](std::string github) { }) - /// .catching([](std::error_condition error) { + /// .fail([](std::error_condition error) { /// error.message(); // Handle the error here /// }); /// ``` @@ -264,8 +266,8 @@ public: /// /// \since version 2.0.0 template - auto catching(T&& callback, - E&& executor = detail::types::this_thread_executor_tag{}) && { + auto fail(T&& callback, + E&& executor = detail::types::this_thread_executor_tag{}) && { return detail::base::chain_error_handler(std::move(*this).materialize(), std::forward(callback), std::forward(executor)); diff --git a/include/continuable/continuable.hpp b/include/continuable/continuable.hpp index fb396ce..76ca6c5 100644 --- a/include/continuable/continuable.hpp +++ b/include/continuable/continuable.hpp @@ -67,7 +67,6 @@ using continuable = typename detail::trait_of< /// function2 backend for the continuable type erasure. /// /// Usable like: `callback` -// TODO Decide whether promises are copyable // template // using promise = typename detail::trait_of< // Args... diff --git a/test/playground/test-playground.cpp b/test/playground/test-playground.cpp index b1b8196..324d685 100644 --- a/test/playground/test-playground.cpp +++ b/test/playground/test-playground.cpp @@ -64,18 +64,26 @@ int main(int, char**) { http_request("github.com") .then([](std::string) { // ... + return 0; }) - .catching([](std::error_condition) { + .fail([](std::error_condition) { + // ... + }) + .then([](int) { // ... }); - /*http_request2("github.com") + http_request2("github.com") .then([](std::string) { // ... + return 0; }) - .catching([](std::error_condition) { + .fail([](std::error_condition) { // ... - });*/ + }) + .then([](int) { + // ... + }); return 0; }