23 #ifndef LIBCOUCHBASE_ERROR_H
24 #define LIBCOUCHBASE_ERROR_H 1
26 #ifndef LIBCOUCHBASE_COUCHBASE_H
27 #error "Include libcouchbase/couchbase.h instead"
91 X(LCB_SUCCESS, 0x00, 0, "Success (Not an error)") \
93 X(LCB_AUTH_CONTINUE, 0x01, LCB_ERRTYPE_INTERNAL|LCB_ERRTYPE_FATAL|LCB_ERRTYPE_SRVGEN, \
94 "Error code used internally within libcouchbase for SASL auth. Should " \
95 "not be visible from the API") \
104 X(LCB_AUTH_ERROR, 0x02, LCB_ERRTYPE_FATAL|LCB_ERRTYPE_INPUT, \
105 "Authentication failed. You may have provided an invalid " \
106 "username/password combination") \
111 X(LCB_DELTA_BADVAL, 0x03, LCB_ERRTYPE_INPUT|LCB_ERRTYPE_DATAOP|LCB_ERRTYPE_SRVGEN, \
112 "The value requested to be incremented is not stored as a number") \
117 X(LCB_E2BIG, 0x04, LCB_ERRTYPE_INPUT|LCB_ERRTYPE_DATAOP|LCB_ERRTYPE_SRVGEN, \
118 "The object requested is too big to store in the server") \
120 X(LCB_EBUSY, 0x05, LCB_ERRTYPE_TRANSIENT, "The server is busy. Try again later") \
122 X(LCB_EINTERNAL, 0x06, LCB_ERRTYPE_INTERNAL, "Internal libcouchbase error") \
127 X(LCB_EINVAL, 0x07, LCB_ERRTYPE_INPUT, "Invalid input/arguments") \
131 X(LCB_ENOMEM, 0x08, LCB_ERRTYPE_TRANSIENT, \
132 "The server is out of memory. Try again later") \
134 X(LCB_ERANGE, 0x09, LCB_ERRTYPE_INPUT|LCB_ERRTYPE_DATAOP|LCB_ERRTYPE_SRVGEN, \
138 X(LCB_ERROR, 0x0A, 0, "Generic error") \
146 X(LCB_ETMPFAIL, 0x0B, LCB_ERRTYPE_TRANSIENT|LCB_ERRTYPE_SRVLOAD|LCB_ERRTYPE_SRVGEN, \
147 "Temporary failure received from server. Try again later") \
153 X(LCB_KEY_EEXISTS, 0x0C, LCB_ERRTYPE_DATAOP|LCB_ERRTYPE_SRVGEN, \
154 "The key already exists in the server. If you have supplied a CAS then " \
155 "the key exists with a CAS value different than specified") \
158 X(LCB_KEY_ENOENT, 0x0D, LCB_ERRTYPE_DATAOP|LCB_ERRTYPE_SRVGEN, \
159 "The key does not exist on the server") \
162 X(LCB_DLOPEN_FAILED, 0x0E, LCB_ERRTYPE_INPUT|LCB_ERRTYPE_FATAL|LCB_ERRTYPE_PLUGIN, \
163 "Could not locate plugin library") \
166 X(LCB_DLSYM_FAILED, 0x0F, LCB_ERRTYPE_INPUT|LCB_ERRTYPE_FATAL|LCB_ERRTYPE_PLUGIN, \
167 "Required plugin initializer not found") \
175 X(LCB_NETWORK_ERROR, 0x10, LCB_ERRTYPE_NETWORK, "Network failure") \
180 X(LCB_NOT_MY_VBUCKET, 0x11, LCB_ERRTYPE_NETWORK|LCB_ERRTYPE_TRANSIENT|LCB_ERRTYPE_SRVGEN, \
181 "The server which received this command claims it is not hosting this key") \
185 X(LCB_NOT_STORED, 0x12, LCB_ERRTYPE_DATAOP|LCB_ERRTYPE_SRVGEN, \
186 "Item not stored (did you try to append/prepend to a missing key?)") \
195 X(LCB_NOT_SUPPORTED, 0x13, 0, "Operation not supported") \
199 X(LCB_UNKNOWN_COMMAND, 0x14, LCB_ERRTYPE_SRVGEN, "Unknown command") \
206 X(LCB_UNKNOWN_HOST, 0x15, LCB_ERRTYPE_NETWORK|LCB_ERRTYPE_INPUT, \
207 "DNS/Hostname lookup failed") \
210 X(LCB_PROTOCOL_ERROR, 0x16, LCB_ERRTYPE_NETWORK, \
211 "Data received on socket was not in the expected format") \
216 X(LCB_ETIMEDOUT, 0x17, LCB_ERRTYPE_NETWORK|LCB_ERRTYPE_TRANSIENT, \
217 "Client-Side timeout exceeded for operation. Inspect network conditions " \
218 "or increase the timeout") \
221 X(LCB_CONNECT_ERROR, 0x18, LCB_ERRTYPE_NETWORK, \
222 "Error while establishing TCP connection") \
226 X(LCB_BUCKET_ENOENT, 0x19, LCB_ERRTYPE_INPUT|LCB_ERRTYPE_FATAL, \
227 "The bucket requested does not exist") \
230 X(LCB_CLIENT_ENOMEM, 0x1A, LCB_ERRTYPE_FATAL, \
231 "Memory allocation for libcouchbase failed. Severe problems ahead") \
235 X(LCB_CLIENT_ETMPFAIL, 0x1B, LCB_ERRTYPE_TRANSIENT, \
236 "Temporary failure on the client side. Did you call lcb_connect?") \
238 X(LCB_EBADHANDLE, 0x1C, LCB_ERRTYPE_INPUT, \
239 "Bad handle type for operation. " \
240 "You cannot perform administrative operations on a data handle, or data "\
241 "operations on a cluster handle") \
243 X(LCB_SERVER_BUG, 0x1D, 0, "Encountered a server bug") \
245 X(LCB_PLUGIN_VERSION_MISMATCH, 0x1E, LCB_ERRTYPE_INPUT|LCB_ERRTYPE_FATAL|LCB_ERRTYPE_PLUGIN, \
246 "This version of libcouchbase cannot load the specified plugin") \
248 X(LCB_INVALID_HOST_FORMAT, 0x1F, LCB_ERRTYPE_INPUT, \
249 "Hostname specified for URI is in an invalid format") \
251 X(LCB_INVALID_CHAR, 0x20, LCB_ERRTYPE_INPUT, "Illegal characted") \
256 X(LCB_DURABILITY_ETOOMANY, 0x21, LCB_ERRTYPE_INPUT, \
257 "Durability constraints requires more nodes/replicas than the cluster "\
258 "configuration allows. Durability constraints will never be satisfied") \
260 X(LCB_DUPLICATE_COMMANDS, 0x22, LCB_ERRTYPE_INPUT, \
261 "The same key was specified more than once in the command list") \
266 X(LCB_NO_MATCHING_SERVER, 0x23, LCB_ERRTYPE_TRANSIENT, \
267 "No node was found for servicing this key. This may be a result of a " \
268 "nonexistent/stale cluster configuration") \
274 X(LCB_BAD_ENVIRONMENT, 0x24, LCB_ERRTYPE_FATAL|LCB_ERRTYPE_INPUT, \
275 "The value for an environment variable recognized by libcouchbase was " \
276 "specified in an incorrect format. Check your environment for entries " \
277 "starting with 'LCB_' or 'LIBCOUCHBASE_'") \
279 X(LCB_BUSY, 0x25, LCB_ERRTYPE_INTERNAL, "Busy. This is an internal error") \
282 X(LCB_INVALID_USERNAME, 0x26, LCB_ERRTYPE_INPUT|LCB_ERRTYPE_FATAL, \
283 "The administrative account can no longer be used for data access") \
285 X(LCB_CONFIG_CACHE_INVALID, 0x27, LCB_ERRTYPE_INPUT, \
286 "The contents of the configuration cache file were invalid. Configuration " \
287 "will be fetched from the network") \
292 X(LCB_SASLMECH_UNAVAILABLE, 0x28, LCB_ERRTYPE_INPUT|LCB_ERRTYPE_FATAL, \
293 "The requested SASL mechanism was not supported by the server. Either " \
294 "upgrade the server or change the mechanism requirements") \
298 X(LCB_TOO_MANY_REDIRECTS, 0x29, LCB_ERRTYPE_NETWORK, \
299 "Maximum allowed number of redirects reached. See lcb_cntl and the "\
300 "LCB_CNTL_MAX_REDIRECTS option to modify this limit") \
307 X(LCB_MAP_CHANGED, 0x2A, LCB_ERRTYPE_NETWORK|LCB_ERRTYPE_TRANSIENT, \
308 "The cluster map has changed and this operation could not be completed " \
309 "or retried internally. Try this operation again") \
313 X(LCB_INCOMPLETE_PACKET, 0x2B, LCB_ERRTYPE_TRANSIENT|LCB_ERRTYPE_INPUT, \
314 "Incomplete packet was passed to forward function") \
319 X(LCB_ECONNREFUSED, 0x2C, LCB_ERRTYPE_NETWORK|LCB_ERRTYPE_TRANSIENT, \
320 "The remote host refused the connection. Is the service up?") \
326 X(LCB_ESOCKSHUTDOWN, 0x2D, LCB_ERRTYPE_NETWORK|LCB_ERRTYPE_TRANSIENT, \
327 "The remote host closed the connection") \
333 X(LCB_ECONNRESET, 0x2E, LCB_ERRTYPE_NETWORK|LCB_ERRTYPE_TRANSIENT, \
334 "The connection was forcibly reset by the remote host") \
344 X(LCB_ECANTGETPORT, 0x2F, LCB_ERRTYPE_NETWORK|LCB_ERRTYPE_FATAL, \
345 "Could not assign a local port for this socket. For client sockets this means " \
346 "there are too many TCP sockets open") \
355 X(LCB_EFDLIMITREACHED, 0x30, LCB_ERRTYPE_NETWORK|LCB_ERRTYPE_FATAL, \
356 "The system or process has reached its maximum number of file descriptors") \
362 X(LCB_ENETUNREACH, 0x31, LCB_ERRTYPE_NETWORK|LCB_ERRTYPE_TRANSIENT, \
363 "The remote host was unreachable - is your network OK?") \
367 X(LCB_ECTL_UNKNOWN, 0x32, LCB_ERRTYPE_INPUT, \
368 "Control code passed was unrecognized") \
376 X(LCB_ECTL_UNSUPPMODE, 0x33, LCB_ERRTYPE_INPUT, \
377 "Invalid modifier for cntl operation (e.g. tried to read a write-only value") \
384 X(LCB_ECTL_BADARG, 0x34, LCB_ERRTYPE_INPUT, \
385 "Argument passed to cntl was badly formatted") \
389 X(LCB_EMPTY_KEY, 0x35, LCB_ERRTYPE_INPUT, \
390 "An empty key was passed to an operation") \
396 X(LCB_SSL_ERROR, 0x36, LCB_ERRTYPE_FATAL, \
397 "A generic error related to the SSL subsystem was encountered. Enable logging " \
398 "to see more details") \
403 X(LCB_SSL_CANTVERIFY, 0x37, LCB_ERRTYPE_FATAL, \
404 "Client could not verify server's certificate") \
406 X(LCB_SCHEDFAIL_INTERNAL, 0x38, 0, \
407 "Internal error used for destroying unscheduled command data") \
414 X(LCB_CLIENT_FEATURE_UNAVAILABLE, 0x39, LCB_ERRTYPE_INPUT, \
415 "The requested feature is not supported by the client, either because of " \
416 "settings in the configured instance, or because of options disabled at " \
417 "the time the library was compiled") \
421 X(LCB_OPTIONS_CONFLICT, 0x3A, LCB_ERRTYPE_INPUT, \
422 "The operation structure contains conflicting options")
426 #define X(n, v, cls, s) n = v,
430 #ifdef LIBCOUCHBASE_INTERNAL
438 LCB_MAX_ERROR = 0x1000
442 #define LCB_EIFINPUT(e) (lcb_get_errtype(e) & LCB_ERRTYPE_INPUT)
445 #define LCB_EIFNET(e) (lcb_get_errtype(e) & LCB_ERRTYPE_NETWORK)
448 #define LCB_EIFFATAL(e) (lcb_get_errtype(e) & LCB_ERRTYPE_FATAL)
451 #define LCB_EIFTMP(e) (lcb_get_errtype(e) & LCB_ERRTYPE_TRANSIENT)
454 #define LCB_EIFDATA(e) (lcb_get_errtype(e) & LCB_ERRTYPE_DATAOP)
457 #define LCB_EIFPLUGIN(e) (lcb_get_errtype(e) & LCB_ERRTYPE_PLUGIN)
458 #define LCB_EIFSRVLOAD(e) (lcb_get_errtype(e) & LCB_ERRTYPE_SRVLOAD)
459 #define LCB_EIFSRVGEN(e) (lcb_get_errtype(e) & LCB_ERRTYPE_SRVGEN)
const char * lcb_strerror(lcb_t instance, lcb_error_t error)
Get a textual descrtiption for the given error code.
int lcb_get_errtype(lcb_error_t err)
Get error categories for a specific code.
Error code indicating the server generated this message.
Definition: error.h:77
Error codes which should never be visible to the user.
Definition: error.h:68
lcb_errflags_t
Error Categories.
Definition: error.h:51
Error type indicating a fatal condition within the server or library.
Definition: error.h:59
Error type indicating a likely network failure.
Definition: error.h:56
Error code indicating the server is under load.
Definition: error.h:74
lcb_error_t
Error codes returned by the library.
Definition: error.h:425
Error type indicating a transient condition within the server.
Definition: error.h:62
Error code indicating a plugin failure.
Definition: error.h:71
Error type indicating a likely issue in user input.
Definition: error.h:53
Error type indicating a negative server reply for the data.
Definition: error.h:65
#define LCB_XERR(X)
XMacro for all error types.
Definition: error.h:89