!39703 Fix error log when null-check failed.

Merge pull request !39703 from TronZhang/fix_error_log_for_nullcheck
This commit is contained in:
i-robot 2022-08-05 01:56:04 +00:00 committed by Gitee
commit ae19b79f00
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 15 additions and 15 deletions

View File

@ -314,21 +314,21 @@ inline bool IS_OUTPUT_ON(enum MsLogLevel level) noexcept(true) {
#define MS_EXCEPTION_IF_NULL(ptr) \
do { \
if ((ptr) == nullptr) { \
MS_LOG(EXCEPTION) << ": The pointer[" << #ptr << "] is null."; \
MS_LOG(EXCEPTION) << "The pointer[" << #ptr << "] is null."; \
} \
} while (0)
#define MS_EXCEPTION_IF_CHECK_FAIL(condition, error_info) \
do { \
if (!(condition)) { \
MS_LOG(EXCEPTION) << ": Failure info [" << (error_info) << "]."; \
MS_LOG(EXCEPTION) << "Failure info [" << (error_info) << "]."; \
} \
} while (0)
#define MS_EXCEPTION_IF_ZERO(name, value) \
do { \
if ((value) == 0) { \
MS_LOG(EXCEPTION) << ": The " << (name) << " is zero."; \
MS_LOG(EXCEPTION) << "The " << (name) << " is zero."; \
} \
} while (0)