diff options
| author | David Bremner <david@tethera.net> | 2021-01-03 08:50:12 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-02-06 19:46:46 -0400 |
| commit | 55f5e87096fda96280ccc4b191393c7e59b4df57 (patch) | |
| tree | 068885ea4182e066429963f60d2314a06cf8e31e | |
| parent | c447fe92c7ec3e6730d2cd0d739d8978cf8696f1 (diff) | |
lib: add NOTMUCH_STATUS_DATABASE_EXISTS
It is desirable to distinguish between attempting to create a database
that already exists, and more fatal errors like permission problems.
| -rw-r--r-- | bindings/python-cffi/notmuch2/_build.py | 1 | ||||
| -rw-r--r-- | bindings/python-cffi/notmuch2/_errors.py | 3 | ||||
| -rw-r--r-- | lib/notmuch.h | 4 |
3 files changed, 8 insertions, 0 deletions
diff --git a/bindings/python-cffi/notmuch2/_build.py b/bindings/python-cffi/notmuch2/_build.py index 93828627..f67b4de6 100644 --- a/bindings/python-cffi/notmuch2/_build.py +++ b/bindings/python-cffi/notmuch2/_build.py @@ -51,6 +51,7 @@ ffibuilder.cdef( NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION, NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL, NOTMUCH_STATUS_NO_CONFIG, + NOTMUCH_STATUS_DATABASE_EXISTS, NOTMUCH_STATUS_LAST_STATUS } notmuch_status_t; typedef enum { diff --git a/bindings/python-cffi/notmuch2/_errors.py b/bindings/python-cffi/notmuch2/_errors.py index c97d99cb..65064d4e 100644 --- a/bindings/python-cffi/notmuch2/_errors.py +++ b/bindings/python-cffi/notmuch2/_errors.py @@ -52,6 +52,8 @@ class NotmuchError(Exception): IllegalArgumentError, capi.lib.NOTMUCH_STATUS_NO_CONFIG: NoConfigError, + capi.lib.NOTMUCH_STATUS_DATABASE_EXISTS: + DatabaseExistsError, } return types[status] @@ -97,6 +99,7 @@ class UpgradeRequiredError(NotmuchError): pass class PathError(NotmuchError): pass class IllegalArgumentError(NotmuchError): pass class NoConfigError(NotmuchError): pass +class DatabaseExistsError(NotmuchError): pass class ObjectDestroyedError(NotmuchError): """The object has already been destroyed and it's memory freed. diff --git a/lib/notmuch.h b/lib/notmuch.h index 4f384e58..6d22d328 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -213,6 +213,10 @@ typedef enum _notmuch_status { */ NOTMUCH_STATUS_NO_CONFIG, /** + * Database exists, so not (re)-created + */ + NOTMUCH_STATUS_DATABASE_EXISTS, + /** * Not an actual status value. Just a way to find out how many * valid status values there are. */ |
