libsigrokdecode  unreleased development snapshot
sigrok protocol decoding library
Functions
Error handling

Error handling in libsigrokdecode. More...

Functions

const char * srd_strerror (int error_code)
 Return a human-readable error string for the given libsigrokdecode error code. More...
 
const char * srd_strerror_name (int error_code)
 Return the "name" string of the given libsigrokdecode error code. More...
 

Detailed Description

Error handling in libsigrokdecode.

libsigrokdecode functions usually return SRD_OK upon success, or a negative error code on failure.

Function Documentation

const char* srd_strerror ( int  error_code)

Return a human-readable error string for the given libsigrokdecode error code.

Parameters
error_codeA libsigrokdecode error code number, such as SRD_ERR_MALLOC.
Returns
A const string containing a short, human-readable (English) description of the error, such as "memory allocation error". The string must NOT be free'd by the caller!
See also
srd_strerror_name
Since
0.2.0

Definition at line 55 of file error.c.

References SRD_ERR, SRD_ERR_ARG, SRD_ERR_BUG, SRD_ERR_DECODERS_DIR, SRD_ERR_MALLOC, SRD_ERR_PYTHON, and SRD_OK.

const char* srd_strerror_name ( int  error_code)

Return the "name" string of the given libsigrokdecode error code.

For example, the "name" of the SRD_ERR_MALLOC error code is "SRD_ERR_MALLOC", the name of the SRD_OK code is "SRD_OK", and so on.

This function can be used for various purposes where the "name" string of a libsigrokdecode error code is useful.

Parameters
error_codeA libsigrokdecode error code number, such as SRD_ERR_MALLOC.
Returns
A const string containing the "name" of the error code as string. The string must NOT be free'd by the caller!
See also
srd_strerror
Since
0.2.0

Definition at line 113 of file error.c.

References SRD_ERR, SRD_ERR_ARG, SRD_ERR_BUG, SRD_ERR_DECODERS_DIR, SRD_ERR_MALLOC, SRD_ERR_PYTHON, and SRD_OK.