ReportUserDefinedErrMsg
Description
Reports custom error codes. The U code segment is recommended, for example, EU0001.
It is recommended that a custom error code consist of six characters. For error codes in other formats, such as error codes containing spaces, non–six character error codes, and error codes ending with 8888 or 9999, the function internally reports the error code EU0000.
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 ReportUserDefinedErrMsg(const char *error_code, const char *format, ...)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
error_code |
Input |
User-defined error code. |
format |
Input |
Error information corresponding to the error code. |
... |
Input |
Variable parameter in format, indicating the variable value corresponding to the placeholder in format. |
Returns
- 0: success
- -1: failure