]> git.notmuchmail.org Git - notmuch/commitdiff
lib: add NOTMUCH_STATUS_NO_CONFIG
authorDavid Bremner <david@tethera.net>
Sun, 3 Jan 2021 12:30:46 +0000 (08:30 -0400)
committerDavid Bremner <david@tethera.net>
Sat, 6 Feb 2021 23:43:11 +0000 (19:43 -0400)
This will allow client code to provide more meaningful diagnostics. In
particular it will enable "notmuch new" to continue suggsting the user
run "notmuch setup" to create a config after "notmuch new" is
transitioned to the new  configuration framework.

bindings/python-cffi/notmuch2/_build.py
bindings/python-cffi/notmuch2/_errors.py
lib/notmuch.h
lib/open.cc

index d3bb9104b439a2b2b6802233625929a4a72e36c6..938286271f7e8bc665e2d4db38ed27b153f70b0d 100644 (file)
@@ -50,6 +50,7 @@ ffibuilder.cdef(
         NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL,
         NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION,
         NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL,
+        NOTMUCH_STATUS_NO_CONFIG,
         NOTMUCH_STATUS_LAST_STATUS
     } notmuch_status_t;
     typedef enum {
index 13369445ffabd0b309f0a7a731335bf8b531a5ca..c97d99cbde5fa9fac4e9c159b5c51dd3702ff6c8 100644 (file)
@@ -50,6 +50,8 @@ class NotmuchError(Exception):
                 PathError,
             capi.lib.NOTMUCH_STATUS_ILLEGAL_ARGUMENT:
                 IllegalArgumentError,
+            capi.lib.NOTMUCH_STATUS_NO_CONFIG:
+                NoConfigError,
         }
         return types[status]
 
@@ -94,7 +96,7 @@ class UnsupportedOperationError(NotmuchError): pass
 class UpgradeRequiredError(NotmuchError): pass
 class PathError(NotmuchError): pass
 class IllegalArgumentError(NotmuchError): pass
-
+class NoConfigError(NotmuchError): pass
 
 class ObjectDestroyedError(NotmuchError):
     """The object has already been destroyed and it's memory freed.
index 5ec14c38dd0bfa1b8ca1ce442ff9511371955818..4f384e58881faa7f1a0bc08a40550f45585ac808 100644 (file)
@@ -208,6 +208,10 @@ typedef enum _notmuch_status {
      * something that notmuch doesn't know how to handle.
      */
     NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL,
+    /**
+     * Unable to load a config file
+     */
+    NOTMUCH_STATUS_NO_CONFIG,
     /**
      * Not an actual status value. Just a way to find out how many
      * valid status values there are.
index 6e8e0f6fe30968b0f811f17260ef0c6f2dce53ab..06d079e4c589a9e084b0c1724ce13361722a505c 100644 (file)
@@ -106,7 +106,7 @@ _load_key_file (const char *path,
 
     *key_file = g_key_file_new ();
     if (! g_key_file_load_from_file (*key_file, path, G_KEY_FILE_NONE, NULL)) {
-       status = NOTMUCH_STATUS_FILE_ERROR;
+       status = NOTMUCH_STATUS_NO_CONFIG;
     }
 
 DONE: