aboutsummaryrefslogtreecommitdiff
path: root/bindings/python-cffi/notmuch2/_errors.py
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2022-01-10 10:54:03 -0400
committerDavid Bremner <david@tethera.net>2022-01-10 10:54:03 -0400
commit1b58ea1e66997efdd7ea2a7a83f76890de40fe04 (patch)
tree7db3d1aedaf2ae8e1ff0851ff8c56658273d074e /bindings/python-cffi/notmuch2/_errors.py
parent235b876793ec885b78c7b31904fd69d1a82fbe4a (diff)
parent2394ee6289a2fc2628f198b4a9920116148dd814 (diff)
Merge tag 'debian/0.34.2-1' into debian/bullseye-backports
notmuch release 0.34.2-1 for unstable (sid) [dgit] [dgit distro=debian no-split --quilt=linear]
Diffstat (limited to 'bindings/python-cffi/notmuch2/_errors.py')
-rw-r--r--bindings/python-cffi/notmuch2/_errors.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/bindings/python-cffi/notmuch2/_errors.py b/bindings/python-cffi/notmuch2/_errors.py
index 9301073e..17c3ad9c 100644
--- a/bindings/python-cffi/notmuch2/_errors.py
+++ b/bindings/python-cffi/notmuch2/_errors.py
@@ -56,6 +56,8 @@ class NotmuchError(Exception):
NoDatabaseError,
capi.lib.NOTMUCH_STATUS_DATABASE_EXISTS:
DatabaseExistsError,
+ capi.lib.NOTMUCH_STATUS_BAD_QUERY_SYNTAX:
+ QuerySyntaxError,
}
return types[status]
@@ -81,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'
@@ -103,6 +106,7 @@ class IllegalArgumentError(NotmuchError): pass
class NoConfigError(NotmuchError): pass
class NoDatabaseError(NotmuchError): pass
class DatabaseExistsError(NotmuchError): pass
+class QuerySyntaxError(NotmuchError): pass
class ObjectDestroyedError(NotmuchError):
"""The object has already been destroyed and it's memory freed.