mirror of
https://github.com/Naios/continuable.git
synced 2026-02-08 02:36:40 +08:00
Add the possibility to use custom error types
This commit is contained in:
parent
bc431b4013
commit
268245b5e4
@ -31,11 +31,13 @@
|
|||||||
#ifndef CONTINUABLE_DETAIL_TYPES_HPP_INCLUDED__
|
#ifndef CONTINUABLE_DETAIL_TYPES_HPP_INCLUDED__
|
||||||
#define CONTINUABLE_DETAIL_TYPES_HPP_INCLUDED__
|
#define CONTINUABLE_DETAIL_TYPES_HPP_INCLUDED__
|
||||||
|
|
||||||
|
#ifndef CONTINUABLE_WITH_CUSTOM_ERROR_TYPE
|
||||||
#ifndef CONTINUABLE_WITH_NO_EXCEPTIONS
|
#ifndef CONTINUABLE_WITH_NO_EXCEPTIONS
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#else // CONTINUABLE_WITH_NO_EXCEPTIONS
|
#else // CONTINUABLE_WITH_NO_EXCEPTIONS
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
#endif // CONTINUABLE_WITH_NO_EXCEPTIONS
|
#endif // CONTINUABLE_WITH_NO_EXCEPTIONS
|
||||||
|
#endif // CONTINUABLE_WITH_CUSTOM_ERROR_TYPE
|
||||||
|
|
||||||
#include <continuable/detail/api.hpp>
|
#include <continuable/detail/api.hpp>
|
||||||
#include <continuable/detail/features.hpp>
|
#include <continuable/detail/features.hpp>
|
||||||
@ -44,6 +46,9 @@ namespace cti {
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
/// Contains types used globally across the library
|
/// Contains types used globally across the library
|
||||||
namespace types {
|
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
|
#ifndef CONTINUABLE_WITH_NO_EXCEPTIONS
|
||||||
/// Represents the error type when exceptions are enabled
|
/// Represents the error type when exceptions are enabled
|
||||||
using error_type = std::exception_ptr;
|
using error_type = std::exception_ptr;
|
||||||
@ -51,6 +56,7 @@ using error_type = std::exception_ptr;
|
|||||||
/// Represents the error type when exceptions are disabled
|
/// Represents the error type when exceptions are disabled
|
||||||
using error_type = std::error_condition;
|
using error_type = std::error_condition;
|
||||||
#endif // CONTINUABLE_WITH_NO_EXCEPTIONS
|
#endif // CONTINUABLE_WITH_NO_EXCEPTIONS
|
||||||
|
#endif // CONTINUABLE_WITH_CUSTOM_ERROR_TYPE
|
||||||
|
|
||||||
/// A tag which is used to execute the continuation inside the current thread
|
/// A tag which is used to execute the continuation inside the current thread
|
||||||
struct this_thread_executor_tag {};
|
struct this_thread_executor_tag {};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user