From 7dcd18c964cf842e0fe1241f7a94309724719fb0 Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Tue, 3 Oct 2017 01:48:22 +0200 Subject: [PATCH] Expose dispatch_error_tag and error_type --- include/continuable/continuable-base.hpp | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/include/continuable/continuable-base.hpp b/include/continuable/continuable-base.hpp index 37e9434..7d413f3 100644 --- a/include/continuable/continuable-base.hpp +++ b/include/continuable/continuable-base.hpp @@ -583,6 +583,35 @@ auto make_continuable(Continuation&& continuation) { detail::util::ownership{}); } +/// Represents a tag which can be placed first in a signature +/// in order to overload callables with the asynchronous result +/// as well as an error. +/// +/// See the example below: +/// ```cpp +/// struct my_callable { +/// void operator() (std::string result) { +/// // ... +/// } +/// void operator() (cti::dispatch_error_tag, cti::error_type) { +/// // ... +/// } +/// }; +/// +/// // Will receive errors and results +/// continuable.then(my_callable{}); +/// ``` +using detail::types::dispatch_error_tag; + +/// Represents the type that is used as error type +/// +/// By default this type deduces to `std::exception_ptr`. +/// If `CONTINUABLE_WITH_NO_EXCEPTIONS` is defined the type +/// will be a `std::error_condition`. +/// A custom error type may be set through +/// defining `CONTINUABLE_WITH_CUSTOM_ERROR_TYPE`. +using detail::types::error_type; + /// Connects the given continuables with an *all* logic. /// /// \param continuables The continuable_base objects to connect.