]> git.notmuchmail.org Git - notmuch/commitdiff
properly raise exceptions in python bindings
authorJustus Winter <4winter@informatik.uni-hamburg.de>
Sun, 25 Sep 2011 21:07:35 +0000 (23:07 +0200)
committerSebastian Spaeth <Sebastian@SSpaeth.de>
Thu, 29 Sep 2011 07:48:06 +0000 (09:48 +0200)
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>
bindings/python/notmuch/database.py
bindings/python/notmuch/filename.py
bindings/python/notmuch/message.py
bindings/python/notmuch/tag.py
bindings/python/notmuch/thread.py

index 9fb30e6355d2ca9bca4d90311d2862e9455cb771..e18381ba3bab25368cb1a009700dd94c93973290 100644 (file)
@@ -569,7 +569,7 @@ class Query(object):
         # create query, return None if too little mem available
         query_p = Query._create(db.db_p, _str(querystr))
         if query_p is None:
-            NotmuchError(STATUS.NULL_POINTER)
+            raise NotmuchError(STATUS.NULL_POINTER)
         self._query = query_p
 
     def set_sort(self, sort):
@@ -637,7 +637,7 @@ class Query(object):
         msgs_p = Query._search_messages(self._query)
 
         if msgs_p is None:
-            NotmuchError(STATUS.NULL_POINTER)
+            raise NotmuchError(STATUS.NULL_POINTER)
 
         return Messages(msgs_p, self)
 
index 630886d7977f1578786f5f60a4e0dcb306b926ec..a16e717e778d80fa4c9236ad94249c10ce237ceb 100644 (file)
@@ -68,7 +68,7 @@ class Filenames(object):
              once all derived objects are dead.
         """
         if files_p is None:
-            NotmuchError(STATUS.NULL_POINTER)
+            raise NotmuchError(STATUS.NULL_POINTER)
 
         self._files = files_p
         #save reference to parent object so we keep it alive
index e5f606217f560b179b6db0fb7a25df5dbcdf0865..0c3365b50414068bf7527a533eb8f3a447169780 100644 (file)
@@ -115,7 +115,7 @@ class Messages(object):
                the Python object.(?)
         """
         if msgs_p is None:
-            NotmuchError(STATUS.NULL_POINTER)
+            raise NotmuchError(STATUS.NULL_POINTER)
 
         self._msgs = msgs_p
         #store parent, so we keep them alive as long as self  is alive
@@ -290,7 +290,7 @@ class Message(object):
               objects are dead.
         """
         if msg_p is None:
-            NotmuchError(STATUS.NULL_POINTER)
+            raise NotmuchError(STATUS.NULL_POINTER)
         self._msg = msg_p
         #keep reference to parent, so we keep it alive
         self._parent = parent
index 0f25b0f74d056904a82c09b4f783e0551e88f897..50e3686b6580d65369ac3178d988d90c1837d932 100644 (file)
@@ -70,7 +70,7 @@ class Tags(object):
                cache the tags in the Python object(?)
         """
         if tags_p is None:
-            NotmuchError(STATUS.NULL_POINTER)
+            raise NotmuchError(STATUS.NULL_POINTER)
 
         self._tags = tags_p
         #save reference to parent object so we keep it alive
index 83b4202deb38d4e54371d31be8988e1f582d4625..5e08eb316901b70a3642c5e0b7f4a1d2571b4977 100644 (file)
@@ -95,7 +95,7 @@ class Threads(object):
                the Python object.(?)
         """
         if threads_p is None:
-            NotmuchError(STATUS.NULL_POINTER)
+            raise NotmuchError(STATUS.NULL_POINTER)
 
         self._threads = threads_p
         #store parent, so we keep them alive as long as self  is alive
@@ -206,7 +206,7 @@ class Thread(object):
               objects are dead.
         """
         if thread_p is None:
-            NotmuchError(STATUS.NULL_POINTER)
+            raise NotmuchError(STATUS.NULL_POINTER)
         self._thread = thread_p
         #keep reference to parent, so we keep it alive
         self._parent = parent
@@ -263,7 +263,7 @@ class Thread(object):
         msgs_p = Thread._get_toplevel_messages(self._thread)
 
         if msgs_p is None:
-            NotmuchError(STATUS.NULL_POINTER)
+            raise NotmuchError(STATUS.NULL_POINTER)
 
         return Messages(msgs_p, self)