unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] notmuch.Database.remove_message should raise exception on failure
@ 2016-02-10 16:53 Daniel Kahn Gillmor
  2016-02-11 19:43 ` Justus Winter
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Kahn Gillmor @ 2016-02-10 16:53 UTC (permalink / raw)
  To: Notmuch Mail

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-11 19:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-10 16:53 [PATCH] notmuch.Database.remove_message should raise exception on failure Daniel Kahn Gillmor
2016-02-11 19:43 ` Justus Winter

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).