Hi @gnarlium ,
I’ll try to dig up some more detailed info on errors. As a wrapper for libcouchbase, Python Couchbase Client’s exceptions wrap the standard error codes returned from the server. There is now a system for retrieving a description of each error code from the server using KV Error Map - this is accessible from Python via a connection string setting, as far as I am aware.
# Meta
- RFC Name: KV Error Map
- RFC ID: 0013-kv-error-map
- Start Date: 2016-08-17
- Owner: Brett Lawson (previously Mark Nunberg)
- Current Status: ACCEPTED
# Summary
This proposal outlines the SDK handling of error categories and attributes defined by Couchbase Server 5.0 and above (through [kv-engine](https://github.com/couchbase/kv_engine)).
# Motivation
Currently `memcached` error codes are fixed and implemented either as sequences or as ranges, through enforcement of ranges is only true for newer error codes themselves. Older client versions may not be able to understand newer `memcached` error codes and this results in confusion and at times a stuck client, which cannot appropriately respond. Conversely, `memcached` is also forced to use older legacy error codes when newer more explicit ones may better aid both the understanding and the handling of an error situation. For example, it is much more helpful to return an error code `LOCKED` if an item is locked, than a `TMPFAIL` one - which is currently done.
# Changelog
- *August 17 2016*: Initial Draft
- *March 27 2017*: Add "processing chain" section, Add "retry intervals" section
- *March 28 2017*: Specify that error map is per-node, not per cluster.
- *August 10 2017*: Finalization & cleanup based on last discussions
This file has been truncated. show original
Please look here for an up-to-date account:
# Error Map and Extended Errors
An _Error Map_ is a mapping of error to their attributes and properties.
It is used by connected clients to handle error codes which they may
otherwise not be aware of.
The error map solves the problem where clients would incorrectly handle
newer error codes, and/or where the server would disconnect the client
because it needed to send it a new error code.
The solution via _Error Map_ is to establish a contract between client and
server about certain *attributes* which each error code may have. These
attributes indicate whether an error may be passed through, whether the command
is retriable and so on. When a client receives an error code it does not know
about it, it can look up its attributes and then determine the next course of
action.
## Error Map Format
The error map is a JSON formatted file containing a mapping of error codes
This file has been truncated. show original
With respect to raising CouchbaseErrors as an end-user, this is not something that we cater for normally, as they are intended to be emitted by the SDK only. Do you need these for tests? I guess you can map the exceptions you are expecting to handle to something else for that purpose.
Thanks,
Ellis