From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id N+rCK9PaQGBydAAA0tVLHw (envelope-from ) for ; Thu, 04 Mar 2021 13:04:19 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id CJIvJ9PaQGDnRwAAB5/wlQ (envelope-from ) for ; Thu, 04 Mar 2021 13:04:19 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 02B7F1603F for ; Thu, 4 Mar 2021 14:04:19 +0100 (CET) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id A4B7F27C68; Thu, 4 Mar 2021 08:02:33 -0500 (EST) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 99DB42756C for ; Thu, 4 Mar 2021 08:02:06 -0500 (EST) Received: by fethera.tethera.net (Postfix, from userid 1001) id 78F255FA96; Thu, 4 Mar 2021 08:02:06 -0500 (EST) Received: (nullmailer pid 4047206 invoked by uid 1000); Thu, 04 Mar 2021 13:01:45 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 21/27] lib: add NOTMUCH_STATUS_NO_DATABASE Date: Thu, 4 Mar 2021 09:01:33 -0400 Message-Id: <20210304130139.4046183-22-david@tethera.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210304130139.4046183-1-david@tethera.net> References: <20210304130139.4046183-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: QONDR3JMXIY3HAPYOE7EBOWQJHB6G6QN X-Message-ID-Hash: QONDR3JMXIY3HAPYOE7EBOWQJHB6G6QN X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1614863059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=iH6xNndd3yMoQxBn+fsTWX/W6PKDhikaCqyk+IKglCg=; b=mBCH851eJl++vOShM1tPIthfX0SAJ0/FJIsrP/At4XAieoD21Vufo9yCGwVLc1sYlPXi6C 1EiGdpLjYoXCdVgPpQeaeyfexEbkgwmZX8clVpT6gm2aIMWCHbd1+O5DUk/73+0Wf5XGrL fPOS4egwHVVO0XJ93kfmM7ZaP5KkUsu5UJGec0dh8BhyW/fUwHAQqaAGJWwy3ZhoJh1xFr CyfqPZhTTpcn6lKn8CmaHTEXSWHA8eV9JtcCR3gDMezLFyoqL8KEEZFvwRw3p9krqMuKom PvEiDvlLSQkBN77kRAottN4zNfHEzElxTZ78NP9moVBf2rut1/S3o845YtcYKw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1614863059; a=rsa-sha256; cv=none; b=FKblNvaAYj59ioncJuih9bR46DhxVl6FwslZ8vHpflpPUdx5OFaH/9Yuj7gx/Ay7AbGkxz ev7YdtaXUy67ZKVVtvqqKanozYCyvDO90VDskmFZ0Bygd6GxwRlm0D3pPgKepAnB2FGMkr s5SK68oNWOjr6064zAQtjN/8CypI3SKI9njnJFtUX1zdMh9kzb9lUXQuZafzUSLnIe/2Qs vipd+RjA47tcL5G5yWX5el0ZNVI0G62LOlgW7G6oaaKznvnWskXo+1vrj03RhU8MChrIPb Yu4CjfOH0SXzIeQzeZpQTW47ZUotwfEW5niF/S3ARvehn1PqxdHMPmlk23p2fw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.88 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 02B7F1603F X-Spam-Score: -0.88 X-Migadu-Scanner: scn1.migadu.com X-TUID: 3hWPgk22qFez This will allow more precise return values from various open related functions. --- bindings/python-cffi/notmuch2/_build.py | 1 + bindings/python-cffi/notmuch2/_errors.py | 3 +++ lib/database.cc | 2 ++ lib/notmuch-private.h | 1 + lib/notmuch.h | 4 ++++ 5 files changed, 11 insertions(+) diff --git a/bindings/python-cffi/notmuch2/_build.py b/bindings/python-cffi/notmuch2/_build.py index f67b4de6..f712b6c5 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_NO_DATABASE, NOTMUCH_STATUS_DATABASE_EXISTS, NOTMUCH_STATUS_LAST_STATUS } notmuch_status_t; diff --git a/bindings/python-cffi/notmuch2/_errors.py b/bindings/python-cffi/notmuch2/_errors.py index 65064d4e..9301073e 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_NO_DATABASE: + NoDatabaseError, capi.lib.NOTMUCH_STATUS_DATABASE_EXISTS: DatabaseExistsError, } @@ -99,6 +101,7 @@ class UpgradeRequiredError(NotmuchError): pass class PathError(NotmuchError): pass class IllegalArgumentError(NotmuchError): pass class NoConfigError(NotmuchError): pass +class NoDatabaseError(NotmuchError): pass class DatabaseExistsError(NotmuchError): pass class ObjectDestroyedError(NotmuchError): diff --git a/lib/database.cc b/lib/database.cc index 87ad1385..4c00ff60 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -304,6 +304,8 @@ notmuch_status_to_string (notmuch_status_t status) return "Unknown crypto protocol"; case NOTMUCH_STATUS_NO_CONFIG: return "No configuration file found"; + case NOTMUCH_STATUS_NO_DATABASE: + return "No configuration file found"; case NOTMUCH_STATUS_DATABASE_EXISTS: return "Database exists, not recreated"; default: diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h index b884f060..483974b8 100644 --- a/lib/notmuch-private.h +++ b/lib/notmuch-private.h @@ -142,6 +142,7 @@ typedef enum _notmuch_private_status { NOTMUCH_PRIVATE_STATUS_FAILED_CRYPTO_CONTEXT_CREATION = NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION, NOTMUCH_PRIVATE_STATUS_UNKNOWN_CRYPTO_PROTOCOL = NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL, NOTMUCH_PRIVATE_STATUS_NO_CONFIG = NOTMUCH_STATUS_NO_CONFIG, + NOTMUCH_PRIVATE_STATUS_NO_DATABASE = NOTMUCH_STATUS_NO_DATABASE, NOTMUCH_PRIVATE_STATUS_DATABASE_EXISTS = NOTMUCH_STATUS_DATABASE_EXISTS, /* Then add our own private values. */ diff --git a/lib/notmuch.h b/lib/notmuch.h index f050d2b6..2172d8c8 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -212,6 +212,10 @@ typedef enum _notmuch_status { * Unable to load a config file */ NOTMUCH_STATUS_NO_CONFIG, + /** + * Unable to load a database + */ + NOTMUCH_STATUS_NO_DATABASE, /** * Database exists, so not (re)-created */ -- 2.30.1