cli/new: add better error messages for FILE_ERROR
authorDavid Bremner <david@tethera.net>
Wed, 30 Mar 2016 02:03:02 +0000 (23:03 -0300)
committerDavid Bremner <david@tethera.net>
Wed, 30 Mar 2016 02:07:00 +0000 (23:07 -0300)
The code in add_file seems to assume that NOTMUCH_STATUS_FILE_ERROR is
never returned from add_message. This turns out to be false (although it
seems to only happen in certain fairly rare race conditions).

notmuch-new.c

index e5037761c8ee7f1b481f8aa342dddf5865874f65..04cb5cac092a9cf08def0af2645f89a5d0394c5f 100644 (file)
@@ -281,6 +281,10 @@ add_file (notmuch_database_t *notmuch, const char *filename,
        fprintf (stderr, "Note: Ignoring non-mail file: %s\n", filename);
        break;
     /* Fatal issues. Don't process anymore. */
+    case NOTMUCH_STATUS_FILE_ERROR:
+       fprintf (stderr, "Unexpected error with file %s\n", filename);
+       (void) print_status_database ("add_file", notmuch, status);
+       goto DONE;
     case NOTMUCH_STATUS_READ_ONLY_DATABASE:
     case NOTMUCH_STATUS_XAPIAN_EXCEPTION:
     case NOTMUCH_STATUS_OUT_OF_MEMORY: