Man page of lid_strerror(3) and lid_errno

Dieses Dokument ist nur in englischer Sprache verfügbar.

Index


NAME

lid_errno, lid_strerror - error handling facilities

SYNOPSIS

C/C++ #include <lid.h>

 const char * lid_strerror(lid_errno_t errno);

DESCRIPTION

lid utilizes a concept similar to the traditional errno(3) in order to assist programmers to easily detect, classify and report errors. This way, error recovery can be done in a convenient and common way. However, in contrast to the traditional errno(3) approach, lid_errno is allocated on a per-thread basis instead of using a global variable. Each thread has its own lid_errno variable stored on Thread-Local Storage (TLS) - as a result, lid's error handling facilities are thread-safe.

Whenever an error occurs, lid_errno is set to a value of type lid_errno_t indicating the occurred error.

lid_strerror() may be used to translate the error number provided by lid_errno, that has to be passed as an argument, into a natural language error message (English).

RETURN VALUE

lid_strerror() returns a pointer to a read-only string describing the error with the number lid_errno.

NAMED ERROR CONSTANTS (lid_errno_t)

lid provides named constants (lid_errno_t) for convenient case dependent error handling. The following list states all defined named constants along with their natural language error message as returned by lid_strerror().

LID_NOERR

"No error"

LID_ENOMEM

"Memory allocation failed"

LID_EARG

"Invalid argument"

LID_ESHORT

"Insufficient input length"

LID_EFOPEN

"Failed to open file"

LID_EFCLOSE

"Failed to close file"

LID_EFIO

"File input/output error"

LID_EMATH

"Math error"

LID_EUINV

"Invalid UTF sequence"

LID_EUENC

"UTF encoding failed"

LID_EUDEC

"UTF decoding failed"

LID_EBINARY

"Binary input data"

LID_EUNDEF

"Undefined error"

NOTES

lid_errno is reset to LID_NOERR whenever one of the following functions is called: lid_ffile(), lid_fstr(), lid_fwstr() or lid_fnstr().

SEE ALSO

lid_ffile(3), lid_fstr(3), lid_fwstr(3), lid_fnstr(3)