X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=bindings%2Fpython%2Fnotmuch%2Fdatabase.py;h=5b58e099b1fde6d692f047d0e32c4ccd9ae0493f;hb=243d7e30dcd80041760307d8d0d2a1839f36eca2;hp=7ddf5cfe7d8d265980963ca09a1388b36717c851;hpb=7264732a794b8d59b0aeef395e74381beb4b90f7;p=notmuch diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index 7ddf5cfe..5b58e099 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -157,11 +157,13 @@ class Database(object): _destroy = nmlib.notmuch_database_destroy _destroy.argtypes = [NotmuchDatabaseP] - _destroy.restype = None + _destroy.restype = c_uint def __del__(self): if self._db: - self._destroy(self._db) + status = self._destroy(self._db) + if status != STATUS.SUCCESS: + raise NotmuchError(status) def _assert_db_is_initialized(self): """Raises :exc:`NotInitializedError` if self._db is `None`""" @@ -217,7 +219,7 @@ class Database(object): _close = nmlib.notmuch_database_close _close.argtypes = [NotmuchDatabaseP] - _close.restype = None + _close.restype = c_uint def close(self): ''' @@ -231,7 +233,9 @@ class Database(object): NotmuchError. ''' if self._db: - self._close(self._db) + status = self._close(self._db) + if status != STATUS.SUCCESS: + raise NotmuchError(status) def __enter__(self): '''