From: Daniel Kahn Gillmor Date: Wed, 10 Feb 2016 16:53:46 +0000 (+1900) Subject: [PATCH] notmuch.Database.remove_message should raise exception on failure X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=993bec869c4d03892da622df9a04064b443d25b2;p=notmuch-archives.git [PATCH] notmuch.Database.remove_message should raise exception on failure --- diff --git a/0f/ad8e7caa7d14e3c70b5b18fb4efc72a2760926 b/0f/ad8e7caa7d14e3c70b5b18fb4efc72a2760926 new file mode 100644 index 000000000..63914eb90 --- /dev/null +++ b/0f/ad8e7caa7d14e3c70b5b18fb4efc72a2760926 @@ -0,0 +1,71 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id C09AE6DE179D + for ; Wed, 10 Feb 2016 08:53:52 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.017 +X-Spam-Level: +X-Spam-Status: No, score=-0.017 tagged_above=-999 required=5 + tests=[AWL=-0.017] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id dAiq4Yz8x_3N for ; + Wed, 10 Feb 2016 08:53:51 -0800 (PST) +Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108]) + by arlo.cworth.org (Postfix) with ESMTP id 27E436DE0FF8 + for ; Wed, 10 Feb 2016 08:53:51 -0800 (PST) +Received: from fifthhorseman.net (unknown [38.109.115.130]) + by che.mayfirst.org (Postfix) with ESMTPSA id E15F1F997 + for ; Wed, 10 Feb 2016 11:53:46 -0500 (EST) +Received: by fifthhorseman.net (Postfix, from userid 1000) + id 00C0B200C1; Wed, 10 Feb 2016 11:53:46 -0500 (EST) +From: Daniel Kahn Gillmor +To: Notmuch Mail +Subject: [PATCH] notmuch.Database.remove_message should raise exception on + failure +Date: Wed, 10 Feb 2016 11:53:46 -0500 +Message-Id: <1455123226-1929-1-git-send-email-dkg@fifthhorseman.net> +X-Mailer: git-send-email 2.7.0 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 10 Feb 2016 16:53:52 -0000 + +The notmuch python bindings document that database.remove_message +should raise an exception when the message removal fails, but they +don't actually do it. +--- + bindings/python/notmuch/database.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py +index 93e7b7a..f304533 100644 +--- a/bindings/python/notmuch/database.py ++++ b/bindings/python/notmuch/database.py +@@ -483,7 +483,10 @@ class Database(object): + removed. + """ + self._assert_db_is_initialized() +- return self._remove_message(self._db, _str(filename)) ++ status = self._remove_message(self._db, _str(filename)) ++ if status not in [STATUS.SUCCESS, STATUS.DUPLICATE_MESSAGE_ID]: ++ raise NotmuchError(status) ++ return status + + def find_message(self, msgid): + """Returns a :class:`Message` as identified by its message ID +-- +2.7.0 +