Errors
Types
Name | |
---|---|
enum | hse_err_ctx { HSE_ERR_CTX_NONE} Error context values. |
typedef uint64_t | hse_err_t Generic return type for the HSE library. |
Functions
Name | |
---|---|
int | hse_err_to_errno(hse_err_t err) Return an hse_err_t value's errno representation. |
size_t | hse_strerror(hse_err_t err, char * buf, size_t buf_len) Return an hse_err_t value's string representation. |
enum hse_err_ctx | hse_err_to_ctx(hse_err_t err) Return an hse_err_t value's error context. |
Defines
Name | |
---|---|
HSE_ERR_CTX_BASE Smallest error context value. |
|
HSE_ERR_CTX_MAX Largest error context value. |
Detailed Description
Describes the HSE API return code type and associated utilities.
Types Documentation
enum hse_err_ctx
Enumerator | Value | Description |
---|---|---|
HSE_ERR_CTX_NONE | No context |
Error context values.
typedef hse_err_t
hse_err_t;
Generic return type for the HSE library.
If this scalar quantity is 0 then the call succeeded. If it is non-zero, then the 64-bit quantity can be used by the client in two ways: (1) call hse_err_to_errno() to get a mapping to a POSIX errno value, and (2) call hse_strerror() to get a textual reference about what error occurred and where.
The following special errno error codes are worth mentioning here.
errno | Caller action |
---|---|
EAGAIN | The caller is expected to retry the operation. |
ECANCELED | The caller is expected to retry the operation in a new transaction. See [write conflicts]. |
e.g., the code snippet below shows a typical non-transactional usage:
int retries = 0;
hse_err_t ret = 0;
while (retries < MAX_RETRIES) {
ret = hse_kvs_put(kvs_handle, flags, txn, key, k_len, val, v_len)
if (EAGAIN != hse_err_to_errno(ret))
break;
retries++;
}
Filename: .c
Functions Documentation
function hse_err_to_errno
int hse_err_to_errno(
hse_err_t err
)
Return an hse_err_t value's errno representation.
Parameters:
- err Error value returned from an HSE API function.
Return: Error's errno equivalent.
Note: This function is thread safe.
The hse_err_t scalar value err
is translated into its errno equivalent.
function hse_strerror
size_t hse_strerror(
hse_err_t err,
char * buf,
size_t buf_len
)
Return an hse_err_t value's string representation.
Parameters:
- err Error value returned from an HSE API function.
- buf Buffer to hold the formatted string.
- buf_len Length of buffer.
Return: The number of characters (excluding the terminating NULL byte) which would have been written to the final string if enough space had been available.
Note: This function is thread safe.
The hse_err_t scalar value err
is decoded into a NULL-terminated string representation giving more information about the error and where it occurred. The string will be truncated if buf_len
is too small (a buf_len
value of 128 is sufficient to avoid truncation of most error strings).
function hse_err_to_ctx
enum hse_err_ctx hse_err_to_ctx(
hse_err_t err
)
Return an hse_err_t value's error context.
Parameters:
- err Error value returned from an HSE API function.
Return: The error's context.
Note: This function is thread safe.
The error context value is retrieved from the hse_err_t value.
Macros Documentation
define HSE_ERR_CTX_BASE
#define HSE_ERR_CTX_BASE [HSE_ERR_CTX_NONE](/2.x/api/Modules/group__ERRORS/#enumvalue-hse_err_ctx_none)
Smallest error context value.
define HSE_ERR_CTX_MAX
#define HSE_ERR_CTX_MAX [HSE_ERR_CTX_NONE](/2.x/api/Modules/group__ERRORS/#enumvalue-hse_err_ctx_none)
Largest error context value.
Updated on 17 November 2022 at 15:10:57 CST