This is an automated email from the ASF dual-hosted git repository.
wangdan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push:
new 49a742b5e feat(marco): Add RETURN_ERRS_NOT_TRUE marco to simplify code
(#1849)
49a742b5e is described below
commit 49a742b5e67da1cd7f99238495fad318b839d939
Author: Samunroyu <[email protected]>
AuthorDate: Fri Jan 12 15:41:16 2024 +0800
feat(marco): Add RETURN_ERRS_NOT_TRUE marco to simplify code (#1849)
---
src/utils/errors.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/utils/errors.h b/src/utils/errors.h
index e8ac9aee9..29ba0210b 100644
--- a/src/utils/errors.h
+++ b/src/utils/errors.h
@@ -238,3 +238,10 @@ USER_DEFINED_STRUCTURE_FORMATTER(::dsn::error_s);
const ::dsn::error_s &_s = (s);
\
CHECK(_s.is_ok(), fmt::format(__VA_ARGS__));
\
} while (false);
+
+#define RETURN_ERRS_NOT_TRUE(exp, code, ...)
\
+ do {
\
+ if (dsn_unlikely(!(exp))) {
\
+ return dsn::error_s::make(code, fmt::format(__VA_ARGS__));
\
+ }
\
+ } while (false)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]