Merge branch 'release'

This commit is contained in:
David Bremner 2021-12-05 09:02:50 -04:00
commit 95f0c59fe9
2 changed files with 10 additions and 1 deletions

View file

@ -83,7 +83,8 @@ class NotmuchError(Exception):
if self.message:
return self.message
elif self.status:
return capi.lib.notmuch_status_to_string(self.status)
char_str = capi.lib.notmuch_status_to_string(self.status)
return capi.ffi.string(char_str).decode(errors='replace')
else:
return 'Unknown error'

View file

@ -0,0 +1,8 @@
from notmuch2 import _capi as capi
from notmuch2 import _errors as errors
def test_status_no_message():
exc = errors.NotmuchError(capi.lib.NOTMUCH_STATUS_PATH_ERROR)
assert exc.status == capi.lib.NOTMUCH_STATUS_PATH_ERROR
assert exc.message is None
assert str(exc) == 'Path supplied is illegal for this function'