ReportInnerErrMsg

Description

Reports the internal error information predefined by CANN and some information about the call site, such as the file name, function name, and line number.

If the formatted string provided by the user is longer than 1024 (including "\0" at the end), the API returns the error code -1, indicating failure. For example, if the formatted string is "Error:%s" and the length of the input string is 1000, the total length (including "Error:" and "\0" at the end) is 1007. In this case, the API is successfully called. However, if the length of the input string is 1020, the total length (including "Error:" and "\0" at the end) is 1027, exceeding 1024. In this case, the API fails to be called.

Prototype

int32_t ReportInnerErrMsg(const char_t *file_name, const char_t *func, uint32_t line, const char *error_code, const char_t *format, ...)

The macro REPORT_INNER_ERR_MSG for encapsulating this API is also provided. The macro definition is as follows:

#define REPORT_INNER_ERR_MSG(error_code, format, ...) \
    (void)ge::ReportInnerErrMsg(__FILE__, __FUNCTION__, __LINE__, (error_code), (format), ##__VA_ARGS__)

Parameters

Parameter

Input/Output

Description

file_name

Input

Name of the file where ReportInnerErrMsg is called. The value is fixed at __FILE__.

func

Input

Name of the function where ReportInnerErrMsg is called. The value is fixed at __FUNCTION__.

line

Input

Number of the line where ReportInnerErrMsg is called. The value is fixed at __LINE__.

error_code

Input

Internal error predefined by CANN.

An error code consists of six characters, for example, E19999. The first character indicates the level, which can be E (error), W (warning), or I (info). The second character indicates the module. The last four characters indicate the error code. Error codes 9000 to 9999 are internal error codes.

format

Input

Error message.

When the formatting function is called, the type and number of parameters in format must be the same as the actual ones.

...

Input

Variable parameter in format, which is added based on the error information.

Returns

None