Couchbase C Client  3.3.12
Asynchronous C Client for Couchbase
Error Codes

Detailed Description

Status codes returned by the library

Function Documentation

◆ lcb_error_flags()

uint32_t lcb_error_flags ( lcb_STATUS err)

Get error categories for a specific code.

Parameters
errthe error received
Returns
a set of flags containing the categories for the given error
Stability
Committed

◆ lcb_strerror_short()

◆ lcb_errmap_default()

lcb_STATUS lcb_errmap_default ( lcb_INSTANCE * instance,
lcb_U16 code )

This may be used in conjunction with the errmap callback if it wishes to fallback for default behavior for the given code.

Stability
Uncommitted

◆ lcb_set_errmap_callback()

lcb_errmap_callback lcb_set_errmap_callback ( lcb_INSTANCE * instance,
lcb_errmap_callback  )
Stability
Uncommitted

◆ lcb_retry_strategy()

lcb_STATUS lcb_retry_strategy ( lcb_INSTANCE * instance,
lcb_RETRY_STRATEGY strategy )

Set the global retry strategy.

A strategy is a function pointer (see typedef above) which takes a lcb_RETRY_REQUEST and an lcb_RETRY_REASON, and returns a lcb_RETRY_ACTION. There are a number of lcb_retry_reason_*** and lcb_retry_request_*** functions one can use to formulate a stragegy. The simplest possible strategy:

lcb_RETRY_ACTION lcb_retry_strategy_fail_fast(lcb_RETRY_REQUEST *req, lcb_RETRY_REASON reason) {
lcb_RETRY_ACTION res{0, 0};
return res;
}

This sets should_retry to false for all requests. Below, we use the functions mentioned above to formulate a more nuanced strategy:

lcb_RETRY_ACTION lcb_retry_strategy_best_effort(lcb_RETRY_REQUEST *req, lcb_RETRY_REASON reason) {
lcb_RETRY_ACTION res{0, 0};
if (lcb_retry_request_is_idempotent(req) || lcb_retry_reason_allows_non_idempotent_retry(reason)) {
res.should_retry = 1;
res.retry_after_ms = 0;
}
return res;
}

These 2 strategies are pre-defined for you to use, or you can formulate your own.

Typedef Documentation

◆ lcb_errmap_callback

typedef lcb_STATUS(* lcb_errmap_callback) (lcb_INSTANCE *instance, lcb_U16 bincode)

Callback for error mappings.

This will be invoked when requesting whether the user has a possible mapping for this error code.

This will be called for response codes which may be ambiguous in most use cases, or in cases where detailed response codes may be mapped to more generic ones.

Enumeration Type Documentation

◆ lcb_STATUS

enum lcb_STATUS

Error codes returned by the library.

Enumerator
LCB_MAX_ERROR 

The errors below this value reserved for libcouchbase usage.