mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-28 21:54:10 +01:00
properly raise exceptions in python bindings
There are various locations where exceptions are constructed but not raised. This patch adds the necessary raise statements. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
This commit is contained in:
parent
34990908e7
commit
19daa117b9
5 changed files with 9 additions and 9 deletions
|
@ -569,7 +569,7 @@ class Query(object):
|
||||||
# create query, return None if too little mem available
|
# create query, return None if too little mem available
|
||||||
query_p = Query._create(db.db_p, _str(querystr))
|
query_p = Query._create(db.db_p, _str(querystr))
|
||||||
if query_p is None:
|
if query_p is None:
|
||||||
NotmuchError(STATUS.NULL_POINTER)
|
raise NotmuchError(STATUS.NULL_POINTER)
|
||||||
self._query = query_p
|
self._query = query_p
|
||||||
|
|
||||||
def set_sort(self, sort):
|
def set_sort(self, sort):
|
||||||
|
@ -637,7 +637,7 @@ class Query(object):
|
||||||
msgs_p = Query._search_messages(self._query)
|
msgs_p = Query._search_messages(self._query)
|
||||||
|
|
||||||
if msgs_p is None:
|
if msgs_p is None:
|
||||||
NotmuchError(STATUS.NULL_POINTER)
|
raise NotmuchError(STATUS.NULL_POINTER)
|
||||||
|
|
||||||
return Messages(msgs_p, self)
|
return Messages(msgs_p, self)
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ class Filenames(object):
|
||||||
once all derived objects are dead.
|
once all derived objects are dead.
|
||||||
"""
|
"""
|
||||||
if files_p is None:
|
if files_p is None:
|
||||||
NotmuchError(STATUS.NULL_POINTER)
|
raise NotmuchError(STATUS.NULL_POINTER)
|
||||||
|
|
||||||
self._files = files_p
|
self._files = files_p
|
||||||
#save reference to parent object so we keep it alive
|
#save reference to parent object so we keep it alive
|
||||||
|
|
|
@ -115,7 +115,7 @@ class Messages(object):
|
||||||
the Python object.(?)
|
the Python object.(?)
|
||||||
"""
|
"""
|
||||||
if msgs_p is None:
|
if msgs_p is None:
|
||||||
NotmuchError(STATUS.NULL_POINTER)
|
raise NotmuchError(STATUS.NULL_POINTER)
|
||||||
|
|
||||||
self._msgs = msgs_p
|
self._msgs = msgs_p
|
||||||
#store parent, so we keep them alive as long as self is alive
|
#store parent, so we keep them alive as long as self is alive
|
||||||
|
@ -290,7 +290,7 @@ class Message(object):
|
||||||
objects are dead.
|
objects are dead.
|
||||||
"""
|
"""
|
||||||
if msg_p is None:
|
if msg_p is None:
|
||||||
NotmuchError(STATUS.NULL_POINTER)
|
raise NotmuchError(STATUS.NULL_POINTER)
|
||||||
self._msg = msg_p
|
self._msg = msg_p
|
||||||
#keep reference to parent, so we keep it alive
|
#keep reference to parent, so we keep it alive
|
||||||
self._parent = parent
|
self._parent = parent
|
||||||
|
|
|
@ -70,7 +70,7 @@ class Tags(object):
|
||||||
cache the tags in the Python object(?)
|
cache the tags in the Python object(?)
|
||||||
"""
|
"""
|
||||||
if tags_p is None:
|
if tags_p is None:
|
||||||
NotmuchError(STATUS.NULL_POINTER)
|
raise NotmuchError(STATUS.NULL_POINTER)
|
||||||
|
|
||||||
self._tags = tags_p
|
self._tags = tags_p
|
||||||
#save reference to parent object so we keep it alive
|
#save reference to parent object so we keep it alive
|
||||||
|
|
|
@ -95,7 +95,7 @@ class Threads(object):
|
||||||
the Python object.(?)
|
the Python object.(?)
|
||||||
"""
|
"""
|
||||||
if threads_p is None:
|
if threads_p is None:
|
||||||
NotmuchError(STATUS.NULL_POINTER)
|
raise NotmuchError(STATUS.NULL_POINTER)
|
||||||
|
|
||||||
self._threads = threads_p
|
self._threads = threads_p
|
||||||
#store parent, so we keep them alive as long as self is alive
|
#store parent, so we keep them alive as long as self is alive
|
||||||
|
@ -206,7 +206,7 @@ class Thread(object):
|
||||||
objects are dead.
|
objects are dead.
|
||||||
"""
|
"""
|
||||||
if thread_p is None:
|
if thread_p is None:
|
||||||
NotmuchError(STATUS.NULL_POINTER)
|
raise NotmuchError(STATUS.NULL_POINTER)
|
||||||
self._thread = thread_p
|
self._thread = thread_p
|
||||||
#keep reference to parent, so we keep it alive
|
#keep reference to parent, so we keep it alive
|
||||||
self._parent = parent
|
self._parent = parent
|
||||||
|
@ -263,7 +263,7 @@ class Thread(object):
|
||||||
msgs_p = Thread._get_toplevel_messages(self._thread)
|
msgs_p = Thread._get_toplevel_messages(self._thread)
|
||||||
|
|
||||||
if msgs_p is None:
|
if msgs_p is None:
|
||||||
NotmuchError(STATUS.NULL_POINTER)
|
raise NotmuchError(STATUS.NULL_POINTER)
|
||||||
|
|
||||||
return Messages(msgs_p, self)
|
return Messages(msgs_p, self)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue