mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 04:18:08 +01:00
lib: add NOTMUCH_STATUS_NO_CONFIG
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.
This commit is contained in:
parent
1f860a6c41
commit
eea258c0c9
4 changed files with 9 additions and 2 deletions
|
@ -50,6 +50,7 @@ ffibuilder.cdef(
|
||||||
NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL,
|
NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL,
|
||||||
NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION,
|
NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION,
|
||||||
NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL,
|
NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL,
|
||||||
|
NOTMUCH_STATUS_NO_CONFIG,
|
||||||
NOTMUCH_STATUS_LAST_STATUS
|
NOTMUCH_STATUS_LAST_STATUS
|
||||||
} notmuch_status_t;
|
} notmuch_status_t;
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -50,6 +50,8 @@ class NotmuchError(Exception):
|
||||||
PathError,
|
PathError,
|
||||||
capi.lib.NOTMUCH_STATUS_ILLEGAL_ARGUMENT:
|
capi.lib.NOTMUCH_STATUS_ILLEGAL_ARGUMENT:
|
||||||
IllegalArgumentError,
|
IllegalArgumentError,
|
||||||
|
capi.lib.NOTMUCH_STATUS_NO_CONFIG:
|
||||||
|
NoConfigError,
|
||||||
}
|
}
|
||||||
return types[status]
|
return types[status]
|
||||||
|
|
||||||
|
@ -94,7 +96,7 @@ class UnsupportedOperationError(NotmuchError): pass
|
||||||
class UpgradeRequiredError(NotmuchError): pass
|
class UpgradeRequiredError(NotmuchError): pass
|
||||||
class PathError(NotmuchError): pass
|
class PathError(NotmuchError): pass
|
||||||
class IllegalArgumentError(NotmuchError): pass
|
class IllegalArgumentError(NotmuchError): pass
|
||||||
|
class NoConfigError(NotmuchError): pass
|
||||||
|
|
||||||
class ObjectDestroyedError(NotmuchError):
|
class ObjectDestroyedError(NotmuchError):
|
||||||
"""The object has already been destroyed and it's memory freed.
|
"""The object has already been destroyed and it's memory freed.
|
||||||
|
|
|
@ -208,6 +208,10 @@ typedef enum _notmuch_status {
|
||||||
* something that notmuch doesn't know how to handle.
|
* something that notmuch doesn't know how to handle.
|
||||||
*/
|
*/
|
||||||
NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL,
|
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
|
* Not an actual status value. Just a way to find out how many
|
||||||
* valid status values there are.
|
* valid status values there are.
|
||||||
|
|
|
@ -106,7 +106,7 @@ _load_key_file (const char *path,
|
||||||
|
|
||||||
*key_file = g_key_file_new ();
|
*key_file = g_key_file_new ();
|
||||||
if (! g_key_file_load_from_file (*key_file, path, G_KEY_FILE_NONE, NULL)) {
|
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:
|
DONE:
|
||||||
|
|
Loading…
Reference in a new issue