diff options
author | Ali Polatel <alip@exherbo.org> | 2011-10-04 07:55:29 +0300 |
---|---|---|
committer | Ali Polatel <alip@exherbo.org> | 2011-10-04 07:55:29 +0300 |
commit | 02a30767116ad8abcbd0a3351f2e4d43bbbd655f (patch) | |
tree | 8997ef14cb1b3a64527ec8246e031fed92a170c5 /notmuch-restore.c | |
parent | 9b3f16ce715d2371224955bc5b6f948eaa4ee325 (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 'notmuch-restore.c')
-rw-r--r-- | notmuch-restore.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/notmuch-restore.c b/notmuch-restore.c index f095f64a..e4a5355b 100644 --- a/notmuch-restore.c +++ b/notmuch-restore.c @@ -87,10 +87,13 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[]) file_tags = xstrndup (line + match[2].rm_so, match[2].rm_eo - match[2].rm_so); - message = notmuch_database_find_message (notmuch, message_id); - if (message == NULL) { - fprintf (stderr, "Warning: Cannot apply tags to missing message: %s\n", - message_id); + status = notmuch_database_find_message (notmuch, message_id, &message); + if (status || message == NULL) { + fprintf (stderr, "Warning: Cannot apply tags to %smessage: %s\n", + message ? "" : "missing ", message_id); + if (status) + fprintf (stderr, "%s\n", + notmuch_status_to_string(status)); goto NEXT_LINE; } |