]> git.notmuchmail.org Git - notmuch/blobdiff - lib/message.cc
lib: make find_message{,by_filename) report errors
[notmuch] / lib / message.cc
index 531d304339a62e828a298f707e3517a9ead09519..8f22e02a5cde2d37a614febec9b7ad950dc08631 100644 (file)
@@ -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);