mirror of
https://github.com/Naios/continuable.git
synced 2025-12-06 16:56:44 +08:00
Rename CONTINUABLE_WITH_EXCEPTIONS -> CONTINUABLE_HAS_EXCEPTIONS
* Since this is automatically defined
This commit is contained in:
parent
88aebb422b
commit
09f9da3e0e
@ -44,9 +44,9 @@
|
||||
#include <continuable/detail/types.hpp>
|
||||
#include <continuable/detail/util.hpp>
|
||||
|
||||
#if defined(CONTINUABLE_WITH_EXCEPTIONS)
|
||||
#if defined(CONTINUABLE_HAS_EXCEPTIONS)
|
||||
#include <exception>
|
||||
#endif // CONTINUABLE_WITH_EXCEPTIONS
|
||||
#endif // CONTINUABLE_HAS_EXCEPTIONS
|
||||
|
||||
namespace cti {
|
||||
namespace detail {
|
||||
@ -96,12 +96,12 @@ public:
|
||||
return trait_t::unwrap(std::move(result_));
|
||||
}
|
||||
|
||||
#if defined(CONTINUABLE_WITH_EXCEPTIONS)
|
||||
#if defined(CONTINUABLE_HAS_EXCEPTIONS)
|
||||
std::rethrow_exception(result_.get_exception());
|
||||
#else // CONTINUABLE_WITH_EXCEPTIONS
|
||||
#else // CONTINUABLE_HAS_EXCEPTIONS
|
||||
// Returning error types in await isn't supported as of now
|
||||
util::trap();
|
||||
#endif // CONTINUABLE_WITH_EXCEPTIONS
|
||||
#endif // CONTINUABLE_HAS_EXCEPTIONS
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@ -41,9 +41,9 @@
|
||||
#include <continuable/detail/types.hpp>
|
||||
#include <continuable/detail/util.hpp>
|
||||
|
||||
#if defined(CONTINUABLE_WITH_EXCEPTIONS)
|
||||
#if defined(CONTINUABLE_HAS_EXCEPTIONS)
|
||||
#include <exception>
|
||||
#endif // CONTINUABLE_WITH_EXCEPTIONS
|
||||
#endif // CONTINUABLE_HAS_EXCEPTIONS
|
||||
|
||||
namespace cti {
|
||||
namespace detail {
|
||||
@ -135,7 +135,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(CONTINUABLE_WITH_EXCEPTIONS)
|
||||
#if defined(CONTINUABLE_HAS_EXCEPTIONS)
|
||||
#define CONTINUABLE_BLOCK_TRY_BEGIN try {
|
||||
#define CONTINUABLE_BLOCK_TRY_END \
|
||||
} \
|
||||
@ -144,10 +144,10 @@ public:
|
||||
types::dispatch_error_tag{}, std::current_exception()); \
|
||||
}
|
||||
|
||||
#else // CONTINUABLE_WITH_EXCEPTIONS
|
||||
#else // CONTINUABLE_HAS_EXCEPTIONS
|
||||
#define CONTINUABLE_BLOCK_TRY_BEGIN {
|
||||
#define CONTINUABLE_BLOCK_TRY_END }
|
||||
#endif // CONTINUABLE_WITH_EXCEPTIONS
|
||||
#endif // CONTINUABLE_HAS_EXCEPTIONS
|
||||
|
||||
/// Invokes the given callable object with the given arguments while
|
||||
/// marking the operation as non exceptional.
|
||||
|
||||
@ -82,12 +82,12 @@
|
||||
#define CONTINUABLE_HAS_EXPERIMENTAL_COROUTINE
|
||||
#endif
|
||||
|
||||
/// Define CONTINUABLE_WITH_EXCEPTIONS when exceptions are used
|
||||
/// Define CONTINUABLE_HAS_EXCEPTIONS when exceptions are used
|
||||
#if !defined(CONTINUABLE_WITH_CUSTOM_ERROR_TYPE) && \
|
||||
!defined(CONTINUABLE_WITH_NO_EXCEPTIONS)
|
||||
#define CONTINUABLE_WITH_EXCEPTIONS 1
|
||||
#define CONTINUABLE_HAS_EXCEPTIONS 1
|
||||
#else
|
||||
#undef CONTINUABLE_WITH_EXCEPTIONS
|
||||
#undef CONTINUABLE_HAS_EXCEPTIONS
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
|
||||
@ -149,7 +149,7 @@ void assert_async_binary_exception_validation(V&& validator, C&& continuable,
|
||||
ASSERT_FALSE(*called);
|
||||
*called = true;
|
||||
|
||||
#if defined(CONTINUABLE_WITH_EXCEPTIONS)
|
||||
#if defined(CONTINUABLE_HAS_EXCEPTIONS)
|
||||
try {
|
||||
std::rethrow_exception(error);
|
||||
} catch (std::decay_t<decltype(expected)>& exception) {
|
||||
|
||||
@ -96,7 +96,7 @@ public:
|
||||
|
||||
/// Resolves the promise through the exception
|
||||
void operator()(types::dispatch_error_tag, types::error_type error) {
|
||||
#if defined(CONTINUABLE_WITH_EXCEPTIONS)
|
||||
#if defined(CONTINUABLE_HAS_EXCEPTIONS)
|
||||
promise_.set_exception(error);
|
||||
#else
|
||||
(void)error;
|
||||
@ -105,7 +105,7 @@ public:
|
||||
// to a std::promise. Handle the error first in order
|
||||
// to prevent this trap!
|
||||
util::trap();
|
||||
#endif // CONTINUABLE_WITH_EXCEPTIONS
|
||||
#endif // CONTINUABLE_HAS_EXCEPTIONS
|
||||
}
|
||||
|
||||
/// Returns the future from the promise
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user