aboutsummaryrefslogtreecommitdiffhomepage
path: root/database.cc
diff options
context:
space:
mode:
authorGravatar Carl Worth <cworth@cworth.org>2009-10-25 09:47:21 -0700
committerGravatar Carl Worth <cworth@cworth.org>2009-10-25 10:54:43 -0700
commit3b8e3ab666a54407f9596a53c66ba8ce623ac91d (patch)
tree683f2e40e8e901d9d6bded6d565dc299ec4d6b7d /database.cc
parent9f673f3cf866d114edc77080cd9f9e266d403c14 (diff)
add_message: Propagate error status from notmuch_message_create_for_message_id
What a great feeling to remove an XXX comment.
Diffstat (limited to 'database.cc')
-rw-r--r--database.cc19
1 files changed, 7 insertions, 12 deletions
diff --git a/database.cc b/database.cc
index b3929141..3f8ea903 100644
--- a/database.cc
+++ b/database.cc
@@ -284,7 +284,7 @@ notmuch_database_find_message (notmuch_database_t *notmuch,
if (status == NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND)
return NULL;
- return _notmuch_message_create (notmuch, notmuch, doc_id);
+ return _notmuch_message_create (notmuch, notmuch, doc_id, NULL);
}
/* Return one or more thread_ids, (as a GPtrArray of strings), for the
@@ -762,17 +762,12 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
* database). */
/* Use NULL for owner since we want to free this locally. */
-
- /* XXX: This call can fail by either out-of-memory or an
- * "impossible" Xapian exception. We should rewrite it to
- * allow us to propagate the error status. */
- message = _notmuch_message_create_for_message_id (NULL, notmuch,
- message_id);
- if (message == NULL) {
- fprintf (stderr, "Internal error. This shouldn't happen.\n\n");
- fprintf (stderr, "I mean, it's possible you ran out of memory, but then this code path is still an internal error since it should have detected that and propagated the status value up the stack.\n");
- exit (1);
- }
+ message = _notmuch_message_create_for_message_id (NULL,
+ notmuch,
+ message_id,
+ &ret);
+ if (message == NULL)
+ goto DONE;
/* Has a message previously been added with the same ID? */
old_filename = notmuch_message_get_filename (message);