index: improve error message when file does not seem to be an email

This commit is contained in:
djcb 2013-10-13 19:58:25 +03:00
parent 66ebdf21e0
commit edfdef44a4
2 changed files with 12 additions and 9 deletions

View File

@ -128,9 +128,9 @@ insert_or_update_maybe (const char *fullpath, const char *mdir,
time_t filestamp, MuIndexCallbackData *data,
gboolean *updated)
{
MuMsg *msg;
GError *err;
gboolean rv;
MuMsg *msg;
GError *err;
gboolean rv;
*updated = FALSE;
if (!needs_index (data, fullpath, filestamp))
@ -139,8 +139,13 @@ insert_or_update_maybe (const char *fullpath, const char *mdir,
err = NULL;
msg = mu_msg_new_from_file (fullpath, mdir, &err);
if (!msg) {
g_warning ("error creating message object: %s",
err ? err->message : "cause unknown");
if (!err)
g_warning ("error creating message object: %s",
fullpath);
else {
g_warning ("%s", err->message);
g_clear_error (&err);
}
/* warn, then simply continue */
return MU_OK;
}

View File

@ -155,8 +155,7 @@ init_mime_msg (MuMsgFile *self, const char* path, GError **err)
g_object_unref (stream);
if (!parser) {
g_set_error (err, MU_ERROR_DOMAIN, MU_ERROR_GMIME,
"%s: cannot create mime parser for %s",
__FUNCTION__, path);
"cannot create mime parser for %s", path);
return FALSE;
}
@ -164,8 +163,7 @@ init_mime_msg (MuMsgFile *self, const char* path, GError **err)
g_object_unref (parser);
if (!self->_mime_msg) {
g_set_error (err, MU_ERROR_DOMAIN, MU_ERROR_GMIME,
"%s: cannot construct mime message for %s",
__FUNCTION__, path);
"message seems invalid, ignoring (%s)", path);
return FALSE;
}