API参考
载入中...
搜索中...
未找到
Bsl_err

error module 更多...

Bsl_err 的协作图:

struct  BSL_ERR_Desc
 Add error description. 更多...

宏定义

#define BSL_ERR_NEW_MODULE   0x80
 Start value of the customized level-1 error module.

类型定义

typedef void(* BSL_ERR_OutputFunc) (uint64_t threadId, const char *file, uint32_t lineNo, int32_t errCode, bool mark)
 Err output callback function type.

函数

int32_t BSL_ERR_Init (void)
 Initialize Error code module.
void BSL_ERR_DeInit (void)
 Error code module deinitialization.
void BSL_ERR_RemoveErrorStack (bool isRemoveAll)
 Delete the error stack
int32_t BSL_ERR_GetLastError (void)
 Obtains the error code of the last push in the error stack.
int32_t BSL_ERR_PeekLastError (void)
 Obtains the error code of the last push in the error stack.
int32_t BSL_ERR_PeekError (void)
 Obtain the earliest push error code in the error stack.
int32_t BSL_ERR_GetLastErrorFileLine (const char **file, uint32_t *lineNo)
 Obtains the error code, file name, and line number of the last push message in the error stack.
int32_t BSL_ERR_PeekLastErrorFileLine (const char **file, uint32_t *lineNo)
 Obtain the error code, file name, and line number of the last push message in the error stack.
int32_t BSL_ERR_GetError (void)
 Obtain the earliest push error code in the error stack.
int32_t BSL_ERR_GetErrorFileLine (const char **file, uint32_t *lineNo)
 Obtain the error code, file name, and line number of the earliest push message in the error stack.
int32_t BSL_ERR_PeekErrorFileLine (const char **file, uint32_t *lineNo)
 Obtain the error code, file name, and line number of the earliest push message in the error stack.
void BSL_ERR_ClearError (void)
 Clear the error stack.
int32_t BSL_ERR_AddErrStringBatch (const BSL_ERR_Desc *descList, uint32_t num)
 Add an error description string to an error code.
void BSL_ERR_RemoveErrStringBatch (void)
 Delete the error description
const char * BSL_ERR_GetString (int32_t error)
 Obtain the error description string based on the error code.
int32_t BSL_ERR_GetErrAll (const char **file, uint32_t *lineNo, const char **desc)
 Obtain the error description string based on the error code.
int32_t BSL_ERR_SetMark (void)
 Set the pop-up flag at the level of the current error stack.
int32_t BSL_ERR_PopToMark (void)
 Pop to the marked error stack level and clear the mark
int32_t BSL_ERR_ClearLastMark (void)
 Clear the latest flag in the error stack.
void BSL_ERR_RegErrStackLog (const BSL_ERR_OutputFunc func)
 Register a err output callback function with dual protection
void BSL_ERR_OutputErrorStack (void)
 Print all error information in the current error stack.

详细描述

error module

宏定义说明

◆ BSL_ERR_NEW_MODULE

#define BSL_ERR_NEW_MODULE   0x80

Start value of the customized level-1 error module.

Start value of the customized level-1 error module. The value 0x80 is 128.

类型定义说明

◆ BSL_ERR_OutputFunc

typedef void(* BSL_ERR_OutputFunc) (uint64_t threadId, const char *file, uint32_t lineNo, int32_t errCode, bool mark)

Err output callback function type.

Callback function type for error output.

参数
threadId[IN] Thread ID.
file[IN] File name.
lineNo[IN] Line number.
errCode[IN] Error code.
mark[IN] Mark flag.

函数说明

◆ BSL_ERR_AddErrStringBatch()

int32_t BSL_ERR_AddErrStringBatch ( const BSL_ERR_Desc * descList,
uint32_t num )

Add an error description string to an error code.

The error description string is added to the error code. The error description can be extended to the user side.

注意
This function is thread-safe. It stores only string pointers and does not perform deep copy. The same error can be added multiple times and overwrites the previously added error.
参数
descList[IN] BSL_ERR_Desc array
num[IN] Length of descList
返回值
#BSL_SUCCESS.
Fordetails, see bsl_errno.h

◆ BSL_ERR_ClearError()

void BSL_ERR_ClearError ( void )

Clear the error stack.

If an error is detected after the HiTLS API is called, if the error information is ignored, call this API to clear the error information before calling the HiTLS API again.

注意
None

◆ BSL_ERR_ClearLastMark()

int32_t BSL_ERR_ClearLastMark ( void )

Clear the latest flag in the error stack.

Clear the latest flag in the error stack.

注意
None.
返回值
BSL_ERR_ERR_ACQUIRE_WRITE_LOCK_FAIL,failedto obtain the write lock.
BSL_ERR_ERR_NO_STACK,noerror stack.
BSL_SUCCESS,clearedsuccessfully.

◆ BSL_ERR_DeInit()

void BSL_ERR_DeInit ( void )

Error code module deinitialization.

Called by the user when the process exits.

注意
none

◆ BSL_ERR_GetErrAll()

int32_t BSL_ERR_GetErrAll ( const char ** file,
uint32_t * lineNo,
const char ** desc )

Obtain the error description string based on the error code.

Obtain the corresponding error description string based on the error code.

注意
Thread safe : Thread-safe function.
参数
error[IN] Error code
返回值
Errordescription

◆ BSL_ERR_GetError()

int32_t BSL_ERR_GetError ( void )

Obtain the earliest push error code in the error stack.

This API is called when an error occurs on a HiTLS API to obtain the error code. The API can be called all the time. The error code returned each time forms the error stack of the interface until BSL_SUCCESS is returned.

注意
None.
返回值
Errorcode. The most significant 16 bits indicate the ID of the module where the error occurs, and the least significant 16 bits indicate the cause number.

◆ BSL_ERR_GetErrorFileLine()

int32_t BSL_ERR_GetErrorFileLine ( const char ** file,
uint32_t * lineNo )

Obtain the error code, file name, and line number of the earliest push message in the error stack.

The user calls this API after an error occurs on a HiTLS API to obtain an error code, file name, and line number. The obtained information will be deleted from the error stack. This API can be called continuously. The returned error code forms the error stack of the API until BSL_SUCCESS is returned.

注意
If either of the two parameters is null, the file name and line number cannot be obtained.
参数
file[OUT] Obtains the name of the file where the error occurs, excluding the directory path.
lineNo[OUT] Obtain the line number of the file where the error occurs.
返回值
Errorcode. The most significant 16 bits indicate the ID of the module where the error occurs, and the least significant 16 bits indicate the cause number.

◆ BSL_ERR_GetLastError()

int32_t BSL_ERR_GetLastError ( void )

Obtains the error code of the last push in the error stack.

This API is called when an error occurs on a HiTLS interface to obtain the error code. The interface can be called continuously. The error code returned each time forms the error stack of the interface until BSL_SUCCESS is returned.

注意
None.
返回值
Errorcode. The most significant 16 bits indicate the ID of the module where the error occurs, and the least significant 16 bits indicate the cause number.

◆ BSL_ERR_GetLastErrorFileLine()

int32_t BSL_ERR_GetLastErrorFileLine ( const char ** file,
uint32_t * lineNo )

Obtains the error code, file name, and line number of the last push message in the error stack.

When an error occurs in a HiTLS interface, the user obtains an error code, file name, and line number. The obtained information is deleted from the error stack. The interface can be called continuously. The error code returned each time forms the error stack of the interface until BSL_SUCCESS is returned.

注意
If either of the two parameters is null, the file name and line number cannot be obtained
参数
file[OUT] Obtains the name of the file where the error occurs, excluding the directory path
lineNo[OUT] Obtain the line number of the file where the error occurs
返回值
Errorcode. The most significant 16 bits indicate the ID of the module where the error occurs, and the least significant 16 bits indicate the cause number.

◆ BSL_ERR_GetString()

const char * BSL_ERR_GetString ( int32_t error)

Obtain the error description string based on the error code.

Obtain the corresponding error description string based on the error code.

注意
None
参数
error[IN] Error code
返回值
Errordescription

◆ BSL_ERR_Init()

int32_t BSL_ERR_Init ( void )

Initialize Error code module.

The user must call this interface to initialize.

注意
NONE
返回值
BSL_SUCCESS,errorcode module is successfully initialized.
BSL_MALLOC_FAIL,memoryspace is insufficient and thread lock space cannot be applied for.
BSL_SAL_ERR_UNKNOWN,threadlock initialization failed.

◆ BSL_ERR_OutputErrorStack()

void BSL_ERR_OutputErrorStack ( void )

Print all error information in the current error stack.

Print all error information in the current error stack.

注意
none

◆ BSL_ERR_PeekError()

int32_t BSL_ERR_PeekError ( void )

Obtain the earliest push error code in the error stack.

This API is called when an error occurs on a HiTLS API to obtain the error code. The API can be called all the time. The error code returned each time forms the error stack of the interface until BSL_SUCCESS is returned.

注意
Thread safe : Thread-safe function.
返回值
Errorcode. The most significant 16 bits indicate the ID of the module where the error occurs, and the least significant 16 bits indicate the cause number.

◆ BSL_ERR_PeekErrorFileLine()

int32_t BSL_ERR_PeekErrorFileLine ( const char ** file,
uint32_t * lineNo )

Obtain the error code, file name, and line number of the earliest push message in the error stack.

When an error occurs on a HiTLS interface, the user obtains an error code, file name, and line number. The obtained information is not deleted from the error stack.

注意
If either of the two parameters is null, the file name and line number cannot be obtained.
参数
file[OUT] Obtains the name of the file where the error occurs, excluding the directory path.
lineNo[OUT] Obtain the line number of the file where the error occurs.
返回值
Errorcode. The most significant 16 bits indicate the ID of the module where the error occurs, and the least significant 16 bits indicate the cause number.

◆ BSL_ERR_PeekLastError()

int32_t BSL_ERR_PeekLastError ( void )

Obtains the error code of the last push in the error stack.

This API is called when an error occurs on a HiTLS interface to obtain the error code. The interface can be called continuously. The error code returned each time forms the error stack of the interface until BSL_SUCCESS is returned.

注意
Thread safe : Thread-safe function.
返回值
Errorcode. The most significant 16 bits indicate the ID of the module where the error occurs, and the least significant 16 bits indicate the cause number.

◆ BSL_ERR_PeekLastErrorFileLine()

int32_t BSL_ERR_PeekLastErrorFileLine ( const char ** file,
uint32_t * lineNo )

Obtain the error code, file name, and line number of the last push message in the error stack.

When an error occurs on a HiTLS interface, the user obtains an error code, file name, and line number. The obtained information is not deleted from the error stack.

注意
If either of the two parameters is null, the file name and line number cannot be obtained.
参数
file[OUT] Obtains the name of the file where the error occurs, excluding the directory path.
lineNo[OUT] Obtain the line number of the file where the error occurs.
返回值
Errorcode. The most significant 16 bits indicate the ID of the module where the error occurs, and the least significant 16 bits indicate the cause number.

◆ BSL_ERR_PopToMark()

int32_t BSL_ERR_PopToMark ( void )

Pop to the marked error stack level and clear the mark

Pop up to the error stack level of the mark and clear the mark

注意
none
返回值
BSL_ERR_ERR_ACQUIRE_WRITE_LOCK_FAIL,failedto obtain the write lock.
BSL_ERR_ERR_NO_STACK,noerror stack.
BSL_ERR_ERR_NO_ERROR,noerror.
#BSL_ERR_ERR_NO_Mark,nomark.
BSL_SUCCESS,pop-upsucceeded.

◆ BSL_ERR_RegErrStackLog()

void BSL_ERR_RegErrStackLog ( const BSL_ERR_OutputFunc func)

Register a err output callback function with dual protection

参数
funcCallback function to register

◆ BSL_ERR_RemoveErrorStack()

void BSL_ERR_RemoveErrorStack ( bool isRemoveAll)

Delete the error stack

Delete the error stack, which is called when a process or thread exits.

注意
This function must be called when the thread exits. Otherwise, memory leakage occurs.
参数
isRemoveAll[IN] Indicates whether to delete all error stacks. The value is true when a process exits and false when a thread exits.

◆ BSL_ERR_RemoveErrStringBatch()

void BSL_ERR_RemoveErrStringBatch ( void )

Delete the error description

The error description is deleted. If BSL_ERR_AddErrStringBatch is called, you need to use this API to release the memory.

注意
This API must be called when a process exits. Otherwise, memory leakage occurs. Called before releasing the lock.

◆ BSL_ERR_SetMark()

int32_t BSL_ERR_SetMark ( void )

Set the pop-up flag at the level of the current error stack.

Set the pop-up flag.

注意
none
返回值
BSL_ERR_ERR_ACQUIRE_WRITE_LOCK_FAIL,failedto obtain the write lock.
BSL_ERR_ERR_NO_STACK,noerror stack.
BSL_ERR_ERR_NO_ERROR,noerror.
BSL_SUCCESS,theflag is set successfully.