aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/message.cc
diff options
context:
space:
mode:
authorGravatar Ali Polatel <alip@exherbo.org>2011-10-04 07:55:29 +0300
committerGravatar Ali Polatel <alip@exherbo.org>2011-10-04 07:55:29 +0300
commit02a30767116ad8abcbd0a3351f2e4d43bbbd655f (patch)
tree8997ef14cb1b3a64527ec8246e031fed92a170c5 /lib/message.cc
parent9b3f16ce715d2371224955bc5b6f948eaa4ee325 (diff)
lib: make find_message{,by_filename) report errors
Previously, the functions notmuch_database_find_message() and notmuch_database_find_message_by_filename() functions did not properly report error condition to the library user. For more information, read the thread on the notmuch mailing list starting with my mail "id:871uv2unfd.fsf@gmail.com" Make these functions accept a pointer to 'notmuch_message_t' as argument and return notmuch_status_t which may be used to check for any error condition. restore: Modify for the new notmuch_database_find_message() new: Modify for the new notmuch_database_find_message_by_filename()
Diffstat (limited to 'lib/message.cc')
-rw-r--r--lib/message.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/message.cc b/lib/message.cc
index 531d3043..8f22e02a 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -216,11 +216,13 @@ _notmuch_message_create_for_message_id (notmuch_database_t *notmuch,
unsigned int doc_id;
char *term;
- *status_ret = NOTMUCH_PRIVATE_STATUS_SUCCESS;
-
- message = notmuch_database_find_message (notmuch, message_id);
+ *status_ret = (notmuch_private_status_t) notmuch_database_find_message (notmuch,
+ message_id,
+ &message);
if (message)
return talloc_steal (notmuch, message);
+ else if (*status_ret)
+ return NULL;
term = talloc_asprintf (NULL, "%s%s",
_find_prefix ("id"), message_id);