forked from mindspore-Ecosystem/mindspore
!39703 Fix error log when null-check failed.
Merge pull request !39703 from TronZhang/fix_error_log_for_nullcheck
This commit is contained in:
commit
ae19b79f00
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue