From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id WJM/B1QRbWDWHgEAgWs5BA (envelope-from ) for ; Wed, 07 Apr 2021 03:56:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 2IccAVQRbWBsSQAAbx9fmQ (envelope-from ) for ; Wed, 07 Apr 2021 01:56:36 +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 AF3D2A0A5 for ; Wed, 7 Apr 2021 03:56:35 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id D095F29050; Tue, 6 Apr 2021 21:55:59 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 8F7E926BF0 for ; Tue, 6 Apr 2021 21:55:43 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 865585FA96; Tue, 6 Apr 2021 21:55:43 -0400 (EDT) Received: (nullmailer pid 2964250 invoked by uid 1000); Wed, 07 Apr 2021 01:55:35 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 22/28] lib: add NOTMUCH_STATUS_NO_DATABASE Date: Tue, 6 Apr 2021 22:55:24 -0300 Message-Id: <20210407015530.2964017-23-david@tethera.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210407015530.2964017-1-david@tethera.net> References: <20210407015530.2964017-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: MSTDY365IVQL32JPUNTCQJMML5IUKWNW X-Message-ID-Hash: MSTDY365IVQL32JPUNTCQJMML5IUKWNW 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=1617760595; 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=oR2uEG4r2PQ3xqHeZ1Q4tH7i7Ho5BJ8bUxkRAe6mKLA=; b=q/vgvIk6YqbVdA9foD/ltIR+Db3ycnU3NJg/6u+vWIuefiSMPP3Y85l61RUIkWrQONeRwb nL0pNWFCk5HZcF5IJ/yAZFWgszHie32vU0ETqhlSjfVBcWVp8DQ7az/vifdCxsUgowxkZv +6nP385Xit1W/CH3GeQ3/CNsfKDYkFi2OoDPY8Q9shu3hldB+v9bWHbYvZiFU/T8+XTuZP JnMqW/draL7yXVknjWHStUp+UpBZVs9fn2GXkHM2WIRsUd3AWQpPu+87ZExoKenhDDKa7w TCJAjp3CW6/AEQhN6gXcquoF2ymvZ4T5kKEii6MRpyS4VUkUB7fV7QSpJyV7cA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1617760595; a=rsa-sha256; cv=none; b=p0qFICdB50yViNxFn5eNyVKO7zB7uhgBgD3T1W+lHkbt+j2hpIyjfxRUjkJrmEARZEy+PM cQraE8v7Hno0DgehWo6Tm4AnT0lCNi4sGA2wiFVK6FWLdm4K3EB9/KTlW76CV5GPyTtPvo Egd+FBiCRy7gXimlhAzkv8rtG6qIw/W8aBkA9ygcge1M8qNTbS7DSd/ZHq+W2NM2PKo4P3 VS80NrWt3/BvlNKLdmMYFHxKb+21j17CF823cG/sBj3XmQNNclyyLiuI5FWa4XUbAHaSyS VZFfQdkgdl8DqtFy6+Ay8D1QWDyHAANFZhqKqwMNqrXkhJkrg9vcWGsXjSjmUA== 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.02 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: AF3D2A0A5 X-Spam-Score: 0.02 X-Migadu-Scanner: scn0.migadu.com X-TUID: 4zckZSGJsRFk 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 d2ccdd58..96458f6f 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -305,6 +305,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 database 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 387f0c1e..10b1b024 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 2a013be0..9ea05fc5 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.2