diff options
author | ilnurkh <ilnurkh@yandex-team.com> | 2023-10-06 10:08:36 +0300 |
---|---|---|
committer | ilnurkh <ilnurkh@yandex-team.com> | 2023-10-06 10:28:01 +0300 |
commit | e6552744f49f722981ec4ba533d430744410c1f1 (patch) | |
tree | 739d61f3ece0ea4e7493a8cfd15e1267444e4f7d /util/generic/yexception.h | |
parent | 26ca74bbdccfa2d88aa97bf24cb05b9ee8ee3200 (diff) | |
download | ydb-e6552744f49f722981ec4ba533d430744410c1f1.tar.gz |
aliases for checking macroses
https://clubs.at.yandex-team.ru/arcadia/29404
Diffstat (limited to 'util/generic/yexception.h')
-rw-r--r-- | util/generic/yexception.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/util/generic/yexception.h b/util/generic/yexception.h index f4a1bd62056..ee6c4ae51df 100644 --- a/util/generic/yexception.h +++ b/util/generic/yexception.h @@ -187,12 +187,13 @@ std::string CurrentExceptionTypeName(); TString FormatExc(const std::exception& exception); -#define Y_ENSURE_EX(CONDITION, THROW_EXPRESSION) \ - do { \ - if (Y_UNLIKELY(!(CONDITION))) { \ - ythrow THROW_EXPRESSION; \ - } \ +#define Y_THROW_UNLESS_EX(CONDITION, THROW_EXPRESSION) \ + do { \ + if (Y_UNLIKELY(!(CONDITION))) { \ + ythrow THROW_EXPRESSION; \ + } \ } while (false) +#define Y_ENSURE_EX Y_THROW_UNLESS_EX /// @def Y_ENSURE_SIMPLE /// This macro works like the Y_ENSURE, but requires the second argument to be a constant string view. @@ -225,7 +226,8 @@ TString FormatExc(const std::exception& exception); * } * @endcode */ -#define Y_ENSURE(...) Y_PASS_VA_ARGS(Y_MACRO_IMPL_DISPATCHER_2(__VA_ARGS__, Y_ENSURE_IMPL_2, Y_ENSURE_IMPL_1)(__VA_ARGS__)) +#define Y_THROW_UNLESS(...) Y_PASS_VA_ARGS(Y_MACRO_IMPL_DISPATCHER_2(__VA_ARGS__, Y_ENSURE_IMPL_2, Y_ENSURE_IMPL_1)(__VA_ARGS__)) +#define Y_ENSURE Y_THROW_UNLESS /** * @def Y_ENSURE_BT |