]> git.notmuchmail.org Git - notmuch/commitdiff
notmuch.Database.remove_message should raise exception on failure
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Wed, 10 Feb 2016 16:53:46 +0000 (11:53 -0500)
committerJustus Winter <4winter@informatik.uni-hamburg.de>
Thu, 11 Feb 2016 19:41:54 +0000 (20:41 +0100)
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

index 93e7b7a1cb64d8ffa7aa8607bb679546d995ed2d..f30453345e0dabd6a1cb4fa81596c50bdac65143 100644 (file)
@@ -483,7 +483,10 @@ class Database(object):
                removed.
         """
         self._assert_db_is_initialized()
                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
 
     def find_message(self, msgid):
         """Returns a :class:`Message` as identified by its message ID