From 268245b5e4b6bee2c7abd9372a7c08e2f497e786 Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Mon, 2 Oct 2017 17:22:25 +0200 Subject: [PATCH] Add the possibility to use custom error types --- include/continuable/detail/types.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/continuable/detail/types.hpp b/include/continuable/detail/types.hpp index f3be119..5ef995e 100644 --- a/include/continuable/detail/types.hpp +++ b/include/continuable/detail/types.hpp @@ -31,11 +31,13 @@ #ifndef CONTINUABLE_DETAIL_TYPES_HPP_INCLUDED__ #define CONTINUABLE_DETAIL_TYPES_HPP_INCLUDED__ +#ifndef CONTINUABLE_WITH_CUSTOM_ERROR_TYPE #ifndef CONTINUABLE_WITH_NO_EXCEPTIONS #include #else // CONTINUABLE_WITH_NO_EXCEPTIONS #include #endif // CONTINUABLE_WITH_NO_EXCEPTIONS +#endif // CONTINUABLE_WITH_CUSTOM_ERROR_TYPE #include #include @@ -44,6 +46,9 @@ namespace cti { namespace detail { /// Contains types used globally across the library namespace types { +#ifdef CONTINUABLE_WITH_CUSTOM_ERROR_TYPE +using error_type = CONTINUABLE_WITH_CUSTOM_ERROR_TYPE; +#else // CONTINUABLE_WITH_CUSTOM_ERROR_TYPE #ifndef CONTINUABLE_WITH_NO_EXCEPTIONS /// Represents the error type when exceptions are enabled using error_type = std::exception_ptr; @@ -51,6 +56,7 @@ using error_type = std::exception_ptr; /// Represents the error type when exceptions are disabled using error_type = std::error_condition; #endif // CONTINUABLE_WITH_NO_EXCEPTIONS +#endif // CONTINUABLE_WITH_CUSTOM_ERROR_TYPE /// A tag which is used to execute the continuation inside the current thread struct this_thread_executor_tag {};