]> git.notmuchmail.org Git - notmuch/blobdiff - bindings/python/notmuch/database.py
notmuch.Database.remove_message should raise exception on failure
[notmuch] / bindings / python / notmuch / database.py
index f7d04bf4a5690941ab9367eaa1f6925f70b48483..f30453345e0dabd6a1cb4fa81596c50bdac65143 100644 (file)
@@ -36,7 +36,6 @@ from .errors import (
     NotmuchError,
     NullPointerError,
     NotInitializedError,
-    ReadOnlyDatabaseError,
 )
 from .message import Message
 from .tag import Tags
@@ -484,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