23#ifndef LIBCOUCHBASE_ERROR_H
24#define LIBCOUCHBASE_ERROR_H 1
26#ifndef LIBCOUCHBASE_COUCHBASE_H
27#error "Include libcouchbase/couchbase.h instead"
43 LCB_ERROR_TYPE_SUCCESS = 0,
44 LCB_ERROR_TYPE_BASE = 1,
45 LCB_ERROR_TYPE_SHARED = 2,
46 LCB_ERROR_TYPE_KEYVALUE = 3,
47 LCB_ERROR_TYPE_QUERY = 4,
48 LCB_ERROR_TYPE_ANALYTICS = 5,
49 LCB_ERROR_TYPE_SEARCH = 6,
50 LCB_ERROR_TYPE_VIEW = 7,
51 LCB_ERROR_TYPE_MANAGEMENT = 8,
52 LCB_ERROR_TYPE_SDK = 10
56 LCB_ERROR_FLAG_NETWORK = 1u << 0u,
57 LCB_ERROR_FLAG_SUBDOC = 1u << 1u,
58 LCB_ERROR_FLAG_TRANSIENT = 1u << 2u,
59 LCB_ERROR_FLAG_FATAL = 1u << 3u,
60 LCB_ERROR_FLAG_INPUT = 1u << 4u,
64#define LCB_XERROR(X) \
66X(LCB_SUCCESS, 0, LCB_ERROR_TYPE_SUCCESS, 0, "Success (Not an error)") \
67X(LCB_ERR_GENERIC, 100, LCB_ERROR_TYPE_BASE, 0, "Generic error code") \
70X(LCB_ERR_TIMEOUT, 201, LCB_ERROR_TYPE_SHARED, LCB_ERROR_FLAG_NETWORK | LCB_ERROR_FLAG_TRANSIENT, "The request was not completed by the user-defined timeout") \
71X(LCB_ERR_REQUEST_CANCELED, 202, LCB_ERROR_TYPE_SHARED, 0, "A request is cancelled and cannot be resolved in a non-ambiguous way. Most likely the request is in-flight on the socket and the socket gets closed.") \
72X(LCB_ERR_INVALID_ARGUMENT, 203, LCB_ERROR_TYPE_SHARED, LCB_ERROR_FLAG_INPUT, "It is unambiguously determined that the error was caused because of invalid arguments from the user") \
73X(LCB_ERR_SERVICE_NOT_AVAILABLE, 204, LCB_ERROR_TYPE_SHARED, 0, "It was determined from the config unambiguously that the service is not available") \
74X(LCB_ERR_INTERNAL_SERVER_FAILURE, 205, LCB_ERROR_TYPE_SHARED, 0, "Internal server error") \
75X(LCB_ERR_AUTHENTICATION_FAILURE, 206, LCB_ERROR_TYPE_SHARED, LCB_ERROR_FLAG_INPUT, "Authentication error. Possible reasons: incorrect authentication configuration, bucket doesn't exist or bucket may be hibernated.") \
76X(LCB_ERR_TEMPORARY_FAILURE, 207, LCB_ERROR_TYPE_SHARED, LCB_ERROR_FLAG_TRANSIENT, "Temporary failure") \
77X(LCB_ERR_PARSING_FAILURE, 208, LCB_ERROR_TYPE_SHARED, 0, "Parsing failed") \
78X(LCB_ERR_CAS_MISMATCH, 209, LCB_ERROR_TYPE_SHARED, LCB_ERROR_FLAG_INPUT, "CAS mismatch") \
79X(LCB_ERR_BUCKET_NOT_FOUND, 210, LCB_ERROR_TYPE_SHARED, LCB_ERROR_FLAG_INPUT, "A request is made but the current bucket is not found") \
80X(LCB_ERR_COLLECTION_NOT_FOUND, 211, LCB_ERROR_TYPE_SHARED, 0, "A request is made but the current collection (including scope) is not found") \
81X(LCB_ERR_ENCODING_FAILURE, 212, LCB_ERROR_TYPE_SHARED, 0, "Encoding of user object failed while trying to write it to the cluster") \
82X(LCB_ERR_DECODING_FAILURE, 213, LCB_ERROR_TYPE_SHARED, 0, "Decoding of the data into the user object failed") \
83X(LCB_ERR_UNSUPPORTED_OPERATION, 214, LCB_ERROR_TYPE_SHARED, 0, "Unsupported operation") \
84X(LCB_ERR_AMBIGUOUS_TIMEOUT, 215, LCB_ERROR_TYPE_SHARED, 0, "Ambiguous timeout") \
85X(LCB_ERR_UNAMBIGUOUS_TIMEOUT, 216, LCB_ERROR_TYPE_SHARED, 0, "Unambiguous timeout") \
86X(LCB_ERR_SCOPE_NOT_FOUND, 217, LCB_ERROR_TYPE_SHARED, 0, "Scope is not found") \
87X(LCB_ERR_INDEX_NOT_FOUND, 218, LCB_ERROR_TYPE_SHARED, 0, "Index is not found") \
88X(LCB_ERR_INDEX_EXISTS, 219, LCB_ERROR_TYPE_SHARED, 0, "Index is exist already") \
89X(LCB_ERR_RATE_LIMITED, 220, LCB_ERROR_TYPE_SHARED, 0, "The service decided that the caller must be rate limited due to exceeding a rate threshold") \
90X(LCB_ERR_QUOTA_LIMITED, 221, LCB_ERROR_TYPE_SHARED, 0, "The service decided that the caller must be limited due to exceeding a quota threshold") \
93X(LCB_ERR_DOCUMENT_NOT_FOUND, 301, LCB_ERROR_TYPE_KEYVALUE, 0, "Document is not found") \
94X(LCB_ERR_DOCUMENT_UNRETRIEVABLE, 302, LCB_ERROR_TYPE_KEYVALUE, 0, "Document is unretrievable") \
95X(LCB_ERR_DOCUMENT_LOCKED, 303, LCB_ERROR_TYPE_KEYVALUE, 0, "Document locked") \
96X(LCB_ERR_VALUE_TOO_LARGE, 304, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_INPUT, "Value too large") \
97X(LCB_ERR_DOCUMENT_EXISTS, 305, LCB_ERROR_TYPE_KEYVALUE, 0, "Document already exists") \
98X(LCB_ERR_VALUE_NOT_JSON, 306, LCB_ERROR_TYPE_KEYVALUE, 0, "Value is not a JSON") \
99X(LCB_ERR_DURABILITY_LEVEL_NOT_AVAILABLE, 307, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_INPUT, "Durability level is not available") \
100X(LCB_ERR_DURABILITY_IMPOSSIBLE, 308, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_INPUT, "Durability impossible") \
101X(LCB_ERR_DURABILITY_AMBIGUOUS, 309, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_INPUT, "Durability ambiguous") \
102X(LCB_ERR_DURABLE_WRITE_IN_PROGRESS, 310, LCB_ERROR_TYPE_KEYVALUE, 0, "Durable write in progress") \
103X(LCB_ERR_DURABLE_WRITE_RE_COMMIT_IN_PROGRESS, 311, LCB_ERROR_TYPE_KEYVALUE, 0, "Durable write re-commit in progress") \
104X(LCB_ERR_MUTATION_LOST, 312, LCB_ERROR_TYPE_KEYVALUE, 0, "Mutation lost") \
105X(LCB_ERR_SUBDOC_PATH_NOT_FOUND, 313, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC, "Subdoc: path not found") \
106X(LCB_ERR_SUBDOC_PATH_MISMATCH, 314, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC, "Subdoc: path mismatch") \
107X(LCB_ERR_SUBDOC_PATH_INVALID, 315, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC | LCB_ERROR_FLAG_INPUT, "Subdoc: path invalid") \
108X(LCB_ERR_SUBDOC_PATH_TOO_BIG, 316, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC | LCB_ERROR_FLAG_INPUT, "Subdoc: path too big") \
109X(LCB_ERR_SUBDOC_PATH_TOO_DEEP, 317, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC | LCB_ERROR_FLAG_INPUT, "Subdoc: document too deep") \
110X(LCB_ERR_SUBDOC_VALUE_TOO_DEEP, 318, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC | LCB_ERROR_FLAG_INPUT, "Subdoc: value too deep") \
111X(LCB_ERR_SUBDOC_VALUE_INVALID, 319, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC | LCB_ERROR_FLAG_INPUT, "Subdoc: cannot insert value") \
112X(LCB_ERR_SUBDOC_DOCUMENT_NOT_JSON, 320, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC, "Subdoc: document is not a JSON") \
113X(LCB_ERR_SUBDOC_NUMBER_TOO_BIG, 321, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC | LCB_ERROR_FLAG_INPUT, "Subdoc: number is too big") \
114X(LCB_ERR_SUBDOC_DELTA_INVALID, 322, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC | LCB_ERROR_FLAG_INPUT, "Subdoc: invalid delta range") \
115X(LCB_ERR_SUBDOC_PATH_EXISTS, 323, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC, "Subdoc: path already exists") \
116X(LCB_ERR_SUBDOC_XATTR_UNKNOWN_MACRO, 324, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC | LCB_ERROR_FLAG_INPUT, "Subdoc: XATTR unknown macro") \
117X(LCB_ERR_SUBDOC_XATTR_INVALID_FLAG_COMBO, 325, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC | LCB_ERROR_FLAG_INPUT, "Subdoc: XATTR invalid flag combination") \
118X(LCB_ERR_SUBDOC_XATTR_INVALID_KEY_COMBO, 326, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC | LCB_ERROR_FLAG_INPUT, "Subdoc: XATTR invalid key combination") \
119X(LCB_ERR_SUBDOC_XATTR_UNKNOWN_VIRTUAL_ATTRIBUTE, 327, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC | LCB_ERROR_FLAG_INPUT, "Subdoc: XATTR unknown virtual attribute") \
120X(LCB_ERR_SUBDOC_XATTR_CANNOT_MODIFY_VIRTUAL_ATTRIBUTE, 328, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC | LCB_ERROR_FLAG_INPUT, "Subdoc: XATTR cannot modify virtual attribute") \
121X(LCB_ERR_SUBDOC_XATTR_INVALID_ORDER, 329, LCB_ERROR_TYPE_KEYVALUE, LCB_ERROR_FLAG_SUBDOC | LCB_ERROR_FLAG_INPUT, "Subdoc: XATTR invalid order") \
122X(LCB_ERR_DOCUMENT_NOT_LOCKED, 330, LCB_ERROR_TYPE_KEYVALUE, 0, "Document is not locked") \
125X(LCB_ERR_PLANNING_FAILURE, 401, LCB_ERROR_TYPE_QUERY, 0, "Planning failed") \
126X(LCB_ERR_INDEX_FAILURE, 402, LCB_ERROR_TYPE_QUERY, 0, "Query index failure") \
127X(LCB_ERR_PREPARED_STATEMENT_FAILURE, 403, LCB_ERROR_TYPE_QUERY, 0, "Prepared statement failure") \
128X(LCB_ERR_KEYSPACE_NOT_FOUND, 404, LCB_ERROR_TYPE_QUERY, 0, "Keyspace is not found (collection or bucket does not exist)") \
129X(LCB_ERR_DML_FAILURE, 405, LCB_ERROR_TYPE_QUERY, 0, "Data service returned an error during execution of DML statement") \
132X(LCB_ERR_COMPILATION_FAILED, 501, LCB_ERROR_TYPE_ANALYTICS, 0, "Compilation failed") \
133X(LCB_ERR_JOB_QUEUE_FULL, 502, LCB_ERROR_TYPE_ANALYTICS, 0, "Job queue is full") \
134X(LCB_ERR_DATASET_NOT_FOUND, 503, LCB_ERROR_TYPE_ANALYTICS, 0, "Dataset is not found") \
135X(LCB_ERR_DATAVERSE_NOT_FOUND, 504, LCB_ERROR_TYPE_ANALYTICS, 0, "Dataverse is not found") \
136X(LCB_ERR_DATASET_EXISTS, 505, LCB_ERROR_TYPE_ANALYTICS, 0, "Dataset already exists") \
137X(LCB_ERR_DATAVERSE_EXISTS, 506, LCB_ERROR_TYPE_ANALYTICS, 0, "Dataverse already exists") \
138X(LCB_ERR_ANALYTICS_LINK_NOT_FOUND, 507, LCB_ERROR_TYPE_ANALYTICS, 0, "Analytics link is not found") \
143X(LCB_ERR_VIEW_NOT_FOUND, 701, LCB_ERROR_TYPE_VIEW, 0, "View is not found") \
144X(LCB_ERR_DESIGN_DOCUMENT_NOT_FOUND, 702, LCB_ERROR_TYPE_VIEW, 0, "Design document is not found") \
147X(LCB_ERR_COLLECTION_ALREADY_EXISTS, 801, LCB_ERROR_TYPE_MANAGEMENT, 0, "Collection already exists") \
148X(LCB_ERR_SCOPE_EXISTS, 802, LCB_ERROR_TYPE_MANAGEMENT, 0, "Scope already exists") \
149X(LCB_ERR_USER_NOT_FOUND, 803, LCB_ERROR_TYPE_MANAGEMENT, 0, "User is not found") \
150X(LCB_ERR_GROUP_NOT_FOUND, 804, LCB_ERROR_TYPE_MANAGEMENT, 0, "Group is not found") \
151X(LCB_ERR_BUCKET_ALREADY_EXISTS, 805, LCB_ERROR_TYPE_MANAGEMENT, 0, "Bucket already exists") \
154X(LCB_ERR_SSL_INVALID_CIPHERSUITES, 1000, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_FATAL, "OpenSSL encountered an error in the provided ciphersuites (TLS >= 1.3)") \
155X(LCB_ERR_SSL_NO_CIPHERS, 1001, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_FATAL, "OpenSSL does not support any of the ciphers provided (TLS < 1.3)") \
156X(LCB_ERR_SSL_ERROR, 1002, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_FATAL, "A generic error related to the SSL subsystem was encountered. Enable logging to see more details") \
157X(LCB_ERR_SSL_CANTVERIFY, 1003, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_FATAL, "Client could not verify server's certificate") \
158X(LCB_ERR_FD_LIMIT_REACHED, 1004, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_NETWORK | LCB_ERROR_FLAG_FATAL, "The system or process has reached its maximum number of file descriptors") \
159X(LCB_ERR_NODE_UNREACHABLE, 1005, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_NETWORK | LCB_ERROR_FLAG_TRANSIENT, "The remote host is not reachable") \
160X(LCB_ERR_CONTROL_UNKNOWN_CODE, 1006, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "Control code passed was unrecognized") \
161X(LCB_ERR_CONTROL_UNSUPPORTED_MODE, 1007, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "Invalid modifier for cntl operation (e.g. tried to read a write-only value") \
162X(LCB_ERR_CONTROL_INVALID_ARGUMENT, 1008, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "Argument passed to cntl was badly formatted") \
163X(LCB_ERR_DUPLICATE_COMMANDS, 1009, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "The same key was specified more than once in the command list") \
164X(LCB_ERR_NO_MATCHING_SERVER, 1010, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_TRANSIENT, "The node the request was mapped to does not exist in the current cluster map. This may be the result of a failover") \
165X(LCB_ERR_PLUGIN_VERSION_MISMATCH, 1011, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT | LCB_ERROR_FLAG_FATAL, "This version of libcouchbase cannot load the specified plugin") \
166X(LCB_ERR_INVALID_HOST_FORMAT, 1012, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "Hostname specified for URI is in an invalid format") \
167X(LCB_ERR_INVALID_CHAR, 1013, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "Illegal character") \
168X(LCB_ERR_BAD_ENVIRONMENT, 1014, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT | LCB_ERROR_FLAG_FATAL, "The value for an environment variable recognized by libcouchbase was specified in an incorrect format. Check your environment for entries starting with 'LCB_' or 'LIBCOUCHBASE_'") \
169X(LCB_ERR_NO_MEMORY, 1015, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_TRANSIENT, "Memory allocation for libcouchbase failed. Severe problems ahead") \
170X(LCB_ERR_NO_CONFIGURATION, 1016, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_TRANSIENT, "Client not bootstrapped. Ensure bootstrap/connect was attempted and was successful") \
171X(LCB_ERR_DLOPEN_FAILED, 1017, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT | LCB_ERROR_FLAG_FATAL, "Could not locate plugin library") \
172X(LCB_ERR_DLSYM_FAILED, 1018, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT | LCB_ERROR_FLAG_FATAL, "Required plugin initializer not found") \
173X(LCB_ERR_CONFIG_CACHE_INVALID, 1019, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "The contents of the configuration cache file were invalid. Configuration will be fetched from the network") \
174X(LCB_ERR_COLLECTION_MANIFEST_IS_AHEAD, 1020, LCB_ERROR_TYPE_SDK, 0, "Collections manifest of SDK is ahead of Server's") \
175X(LCB_ERR_COLLECTION_NO_MANIFEST, 1021, LCB_ERROR_TYPE_SDK, 0, "No Collections Manifest") \
176X(LCB_ERR_COLLECTION_CANNOT_APPLY_MANIFEST, 1022, LCB_ERROR_TYPE_SDK, 0, "Cannot apply collections manifest") \
177X(LCB_ERR_AUTH_CONTINUE, 1023, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_FATAL, "Error code used internally within libcouchbase for SASL auth. Should not be visible from the API") \
178X(LCB_ERR_CONNECTION_REFUSED, 1024, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_NETWORK | LCB_ERROR_FLAG_TRANSIENT, "The remote host refused the connection") \
179X(LCB_ERR_SOCKET_SHUTDOWN, 1025, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_NETWORK | LCB_ERROR_FLAG_TRANSIENT, "The remote host closed the connection") \
180X(LCB_ERR_CONNECTION_RESET, 1026, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_NETWORK | LCB_ERROR_FLAG_TRANSIENT, "The connection was forcibly reset by the remote host") \
181X(LCB_ERR_CANNOT_GET_PORT, 1027, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_NETWORK | LCB_ERROR_FLAG_FATAL, "Could not assign a local port for this socket. For client sockets this means there are too many TCP sockets open") \
182X(LCB_ERR_INCOMPLETE_PACKET, 1028, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT | LCB_ERROR_FLAG_TRANSIENT, "Incomplete packet was passed to forward function") \
183X(LCB_ERR_SDK_FEATURE_UNAVAILABLE, 1029, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "The requested feature is not supported by the client, either because of settings in the configured instance, or because of options disabled at the time the library was compiled") \
184X(LCB_ERR_OPTIONS_CONFLICT, 1030, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "The operation structure contains conflicting options") \
185X(LCB_ERR_KVENGINE_INVALID_PACKET, 1031, LCB_ERROR_TYPE_SDK, 0, "A badly formatted packet was sent to the server. Please report this in a bug") \
186X(LCB_ERR_DURABILITY_TOO_MANY, 1032, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "Durability constraints requires more nodes/replicas than the cluster configuration allows. Durability constraints will never be satisfied") \
187X(LCB_ERR_SHEDULE_FAILURE, 1033, LCB_ERROR_TYPE_SDK, 0, "Internal error used for destroying unscheduled command data") \
188X(LCB_ERR_DURABILITY_NO_MUTATION_TOKENS, 1034, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "The given item does not have a mutation token associated with it. this is either because fetching mutation tokens was not enabled, or you are trying to check on something not stored by this instance") \
189X(LCB_ERR_SASLMECH_UNAVAILABLE, 1035, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT | LCB_ERROR_FLAG_FATAL, "The requested SASL mechanism was not supported by the server. Either upgrade the server or change the mechanism requirements") \
190X(LCB_ERR_TOO_MANY_REDIRECTS, 1036, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_NETWORK, "Maximum allowed number of redirects reached. See lcb_cntl and the LCB_CNTL_MAX_REDIRECTS option to modify this limit") \
191X(LCB_ERR_MAP_CHANGED, 1037, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_TRANSIENT, "The cluster map has changed and this operation could not be completed or retried internally. Try this operation again") \
192X(LCB_ERR_NOT_MY_VBUCKET, 1038, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_NETWORK | LCB_ERROR_FLAG_TRANSIENT, "The server which received this command claims it is not hosting this key") \
193X(LCB_ERR_UNKNOWN_SUBDOC_COMMAND, 1039, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "Unknown subdocument command") \
194X(LCB_ERR_KVENGINE_UNKNOWN_ERROR, 1040, LCB_ERROR_TYPE_SDK, 0, "The server replied with an unrecognized status code. A newer version of this library may be able to decode it") \
195X(LCB_ERR_NAMESERVER, 1041, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_NETWORK, "Invalid reply received from nameserver") \
196X(LCB_ERR_INVALID_RANGE, 1042, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "Invalid range") \
197X(LCB_ERR_NOT_STORED, 1043, LCB_ERROR_TYPE_SDK, 0, "Item not stored (did you try to append/prepend to a missing key?)") \
198X(LCB_ERR_BUSY, 1044, LCB_ERROR_TYPE_SDK, 0, "Busy. This is an internal error") \
199X(LCB_ERR_SDK_INTERNAL, 1045, LCB_ERROR_TYPE_SDK, 0, "Internal libcouchbase error") \
200X(LCB_ERR_INVALID_DELTA, 1046, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "The value requested to be incremented is not stored as a number") \
201X(LCB_ERR_NO_COMMANDS, 1047, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "No commands specified") \
202X(LCB_ERR_NETWORK, 1048, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_NETWORK, "Generic network failure") \
203X(LCB_ERR_UNKNOWN_HOST, 1049, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT | LCB_ERROR_FLAG_NETWORK, "DNS/Hostname lookup failed") \
204X(LCB_ERR_PROTOCOL_ERROR, 1050, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_NETWORK, "Data received on socket was not in the expected format") \
205X(LCB_ERR_CONNECT_ERROR, 1051, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_NETWORK, "Error while establishing TCP connection") \
206X(LCB_ERR_EMPTY_KEY, 1052, LCB_ERROR_TYPE_SDK, LCB_ERROR_FLAG_INPUT, "An empty key was passed to an operation") \
207X(LCB_ERR_HTTP, 1053, LCB_ERROR_TYPE_SDK, 0, "HTTP Operation failed. Inspect status code for details") \
208X(LCB_ERR_QUERY, 1054, LCB_ERROR_TYPE_SDK, 0, "Query execution failed. Inspect raw response object for information") \
209X(LCB_ERR_TOPOLOGY_CHANGE, 1055, LCB_ERROR_TYPE_SDK, 0, "Topology Change (internal)")
214#define X(n, v, cls, f, s) n = v,
223#define LCB_ERROR_IS_NETWORK(e) ((lcb_error_flags(e) & LCB_ERROR_FLAG_NETWORK) == LCB_ERROR_FLAG_NETWORK)
224#define LCB_ERROR_IS_SUBDOC(e) ((lcb_error_flags(e) & LCB_ERROR_FLAG_SUBDOC) == LCB_ERROR_FLAG_SUBDOC)
225#define LCB_ERROR_IS_TRANSIENT(e) ((lcb_error_flags(e) & LCB_ERROR_FLAG_TRANSIENT) == LCB_ERROR_FLAG_TRANSIENT)
226#define LCB_ERROR_IS_FATAL(e) ((lcb_error_flags(e) & LCB_ERROR_FLAG_FATAL) == LCB_ERROR_FLAG_FATAL)
227#define LCB_ERROR_IS_INPUT(e) ((lcb_error_flags(e) & LCB_ERROR_FLAG_INPUT) == LCB_ERROR_FLAG_INPUT)
229typedef struct lcb_KEY_VALUE_ERROR_CONTEXT_ lcb_KEY_VALUE_ERROR_CONTEXT;
230LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_kv_rc(
const lcb_KEY_VALUE_ERROR_CONTEXT *ctx);
231LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_kv_status_code(
const lcb_KEY_VALUE_ERROR_CONTEXT *ctx, uint16_t *status_code);
232LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_kv_opaque(
const lcb_KEY_VALUE_ERROR_CONTEXT *ctx, uint32_t *opaque);
233LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_kv_cas(
const lcb_KEY_VALUE_ERROR_CONTEXT *ctx, uint64_t *cas);
234LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_kv_key(
const lcb_KEY_VALUE_ERROR_CONTEXT *ctx,
const char **key,
236LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_kv_bucket(
const lcb_KEY_VALUE_ERROR_CONTEXT *ctx,
const char **bucket,
238LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_kv_collection(
const lcb_KEY_VALUE_ERROR_CONTEXT *ctx,
const char **collection,
239 size_t *collection_len);
240LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_kv_scope(
const lcb_KEY_VALUE_ERROR_CONTEXT *ctx,
const char **scope,
242LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_kv_context(
const lcb_KEY_VALUE_ERROR_CONTEXT *ctx,
const char **context,
243 size_t *context_len);
244LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_kv_ref(
const lcb_KEY_VALUE_ERROR_CONTEXT *ctx,
const char **ref,
246LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_kv_endpoint(
const lcb_KEY_VALUE_ERROR_CONTEXT *ctx,
const char **endpoint,
247 size_t *endpoint_len);
249typedef struct lcb_QUERY_ERROR_CONTEXT_ lcb_QUERY_ERROR_CONTEXT;
250LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_query_rc(
const lcb_QUERY_ERROR_CONTEXT *ctx);
251LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_query_first_error_code(
const lcb_QUERY_ERROR_CONTEXT *ctx, uint32_t *code);
252LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_query_first_error_message(
const lcb_QUERY_ERROR_CONTEXT *ctx,
253 const char **message,
size_t *message_len);
254LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_query_error_response_body(
const lcb_QUERY_ERROR_CONTEXT *ctx,
const char **body,
256LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_query_statement(
const lcb_QUERY_ERROR_CONTEXT *ctx,
const char **statement,
257 size_t *statement_len);
258LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_query_client_context_id(
const lcb_QUERY_ERROR_CONTEXT *ctx,
const char **
id,
260LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_query_query_params(
const lcb_QUERY_ERROR_CONTEXT *ctx,
const char **params,
262LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_query_http_response_code(
const lcb_QUERY_ERROR_CONTEXT *ctx, uint32_t *code);
263LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_query_http_response_body(
const lcb_QUERY_ERROR_CONTEXT *ctx,
const char **body,
265LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_query_endpoint(
const lcb_QUERY_ERROR_CONTEXT *ctx,
const char **endpoint,
266 size_t *endpoint_len);
268typedef struct lcb_ANALYTICS_ERROR_CONTEXT_ lcb_ANALYTICS_ERROR_CONTEXT;
269LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_analytics_rc(
const lcb_ANALYTICS_ERROR_CONTEXT *ctx);
270LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_analytics_first_error_code(
const lcb_ANALYTICS_ERROR_CONTEXT *ctx,
272LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_analytics_first_error_message(
const lcb_ANALYTICS_ERROR_CONTEXT *ctx,
273 const char **message,
size_t *message_len);
274LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_analytics_statement(
const lcb_ANALYTICS_ERROR_CONTEXT *ctx,
275 const char **statement,
size_t *statement_len);
276LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_analytics_query_params(
const lcb_ANALYTICS_ERROR_CONTEXT *ctx,
277 const char **query_params,
size_t *query_params_len);
278LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_analytics_client_context_id(
const lcb_ANALYTICS_ERROR_CONTEXT *ctx,
279 const char **
id,
size_t *id_len);
280LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_analytics_http_response_code(
const lcb_ANALYTICS_ERROR_CONTEXT *ctx,
282LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_analytics_http_response_body(
const lcb_ANALYTICS_ERROR_CONTEXT *ctx,
283 const char **body,
size_t *body_len);
284LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_analytics_endpoint(
const lcb_ANALYTICS_ERROR_CONTEXT *ctx,
const char **endpoint,
285 size_t *endpoint_len);
287typedef struct lcb_VIEW_ERROR_CONTEXT_ lcb_VIEW_ERROR_CONTEXT;
288LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_view_rc(
const lcb_VIEW_ERROR_CONTEXT *ctx);
289LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_view_first_error_code(
const lcb_VIEW_ERROR_CONTEXT *ctx,
const char **code,
291LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_view_first_error_message(
const lcb_VIEW_ERROR_CONTEXT *ctx,
const char **message,
292 size_t *message_len);
293LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_view_design_document(
const lcb_VIEW_ERROR_CONTEXT *ctx,
const char **name,
295LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_view_view(
const lcb_VIEW_ERROR_CONTEXT *ctx,
const char **name,
297LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_view_query_params(
const lcb_VIEW_ERROR_CONTEXT *ctx,
const char **params,
299LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_view_http_response_code(
const lcb_VIEW_ERROR_CONTEXT *ctx, uint32_t *code);
300LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_view_http_response_body(
const lcb_VIEW_ERROR_CONTEXT *ctx,
const char **body,
302LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_view_endpoint(
const lcb_VIEW_ERROR_CONTEXT *ctx,
const char **endpoint,
303 size_t *endpoint_len);
305typedef struct lcb_SEARCH_ERROR_CONTEXT_ lcb_SEARCH_ERROR_CONTEXT;
306LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_search_rc(
const lcb_SEARCH_ERROR_CONTEXT *ctx);
307LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_search_error_message(
const lcb_SEARCH_ERROR_CONTEXT *ctx,
const char **message,
308 size_t *message_len);
309LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_search_index_name(
const lcb_SEARCH_ERROR_CONTEXT *ctx,
const char **name,
311LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_search_query(
const lcb_SEARCH_ERROR_CONTEXT *ctx,
const char **query,
313LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_search_params(
const lcb_SEARCH_ERROR_CONTEXT *ctx,
const char **params,
315LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_search_http_response_code(
const lcb_SEARCH_ERROR_CONTEXT *ctx, uint32_t *code);
316LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_search_http_response_body(
const lcb_SEARCH_ERROR_CONTEXT *ctx,
const char **body,
318LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_search_endpoint(
const lcb_SEARCH_ERROR_CONTEXT *ctx,
const char **endpoint,
319 size_t *endpoint_len);
321typedef struct lcb_HTTP_ERROR_CONTEXT_ lcb_HTTP_ERROR_CONTEXT;
322LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_http_rc(
const lcb_HTTP_ERROR_CONTEXT *ctx);
323LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_http_path(
const lcb_HTTP_ERROR_CONTEXT *ctx,
const char **path,
325LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_http_response_code(
const lcb_HTTP_ERROR_CONTEXT *ctx, uint32_t *code);
326LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_http_response_body(
const lcb_HTTP_ERROR_CONTEXT *ctx,
const char **body,
328LIBCOUCHBASE_API
lcb_STATUS lcb_errctx_http_endpoint(
const lcb_HTTP_ERROR_CONTEXT *ctx,
const char **endpoint,
329 size_t *endpoint_len);
376#define LCB_XRETRY_REASON(X) \
378 X(LCB_RETRY_REASON_UNKNOWN, 0, 0, 0) \
379 X(LCB_RETRY_REASON_SOCKET_NOT_AVAILABLE, 1, 1, 0) \
380 X(LCB_RETRY_REASON_SERVICE_NOT_AVAILABLE, 2, 1, 0) \
381 X(LCB_RETRY_REASON_NODE_NOT_AVAILABLE, 3, 1, 0) \
382 X(LCB_RETRY_REASON_KV_NOT_MY_VBUCKET, 4, 1, 1) \
383 X(LCB_RETRY_REASON_KV_COLLECTION_OUTDATED, 5, 1, 1) \
384 X(LCB_RETRY_REASON_KV_ERROR_MAP_RETRY_INDICATED, 6, 1, 0) \
385 X(LCB_RETRY_REASON_KV_LOCKED, 7, 1, 0) \
386 X(LCB_RETRY_REASON_KV_TEMPORARY_FAILURE, 8, 1, 0) \
387 X(LCB_RETRY_REASON_KV_SYNC_WRITE_IN_PROGRESS, 9, 1, 0) \
388 X(LCB_RETRY_REASON_KV_SYNC_WRITE_RE_COMMIT_IN_PROGRESS, 10, 1, 0) \
389 X(LCB_RETRY_REASON_SERVICE_RESPONSE_CODE_INDICATED, 11, 1, 0) \
390 X(LCB_RETRY_REASON_SOCKET_CLOSED_WHILE_IN_FLIGHT, 12, 0, 0) \
391 X(LCB_RETRY_REASON_CIRCUIT_BREAKER_OPEN, 13, 1, 0) \
392 X(LCB_RETRY_REASON_QUERY_PREPARED_STATEMENT_FAILURE, 14, 1, 0) \
393 X(LCB_RETRY_REASON_ANALYTICS_TEMPORARY_FAILURE, 15, 1, 0) \
394 X(LCB_RETRY_REASON_SEARCH_TOO_MANY_REQUESTS, 16, 1, 0) \
395 X(LCB_RETRY_REASON_QUERY_ERROR_RETRYABLE, 17, 1, 0)
399#define X(n, c, nir, ar) n = c,
404typedef struct lcb_RETRY_REQUEST_ lcb_RETRY_REQUEST;
406LIBCOUCHBASE_API
int lcb_retry_reason_allows_non_idempotent_retry(lcb_RETRY_REASON code);
407LIBCOUCHBASE_API
int lcb_retry_reason_is_always_retry(lcb_RETRY_REASON code);
409LIBCOUCHBASE_API
int lcb_retry_request_is_idempotent(lcb_RETRY_REQUEST *req);
410LIBCOUCHBASE_API
int lcb_retry_request_retry_attempts(lcb_RETRY_REQUEST *req);
411LIBCOUCHBASE_API
void *lcb_retry_request_operation_cookie(lcb_RETRY_REQUEST *req);
414 uint32_t should_retry;
415 uint32_t retry_after_ms;
418typedef lcb_RETRY_ACTION (*lcb_RETRY_STRATEGY)(lcb_RETRY_REQUEST *req, lcb_RETRY_REASON reason);
LCB_INTERNAL_API const char * lcb_strerror_long(lcb_STATUS error)
Get a longer textual description of an error message.
uint32_t lcb_error_flags(lcb_STATUS err)
Get error categories for a specific code.
lcb_STATUS(* lcb_errmap_callback)(lcb_INSTANCE *instance, lcb_U16 bincode)
Callback for error mappings.
Definition error.h:369
lcb_errmap_callback lcb_set_errmap_callback(lcb_INSTANCE *instance, lcb_errmap_callback)
LCB_INTERNAL_API const char * lcb_strerror_short(lcb_STATUS error)
Get a shorter textual description of an error message.
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 behavio...
lcb_STATUS lcb_retry_strategy(lcb_INSTANCE *instance, lcb_RETRY_STRATEGY strategy)
Set the global retry strategy.
lcb_STATUS
Error codes returned by the library.
Definition error.h:213
@ LCB_MAX_ERROR
The errors below this value reserved for libcouchbase usage.
Definition error.h:219
struct lcb_st lcb_INSTANCE
Library handle representing a connection to a cluster and its data buckets.
Definition couchbase.h:35