mirror of https://github.com/djcb/mu.git
* mu-cmd.c: improve error handling (when mu_index_new fails)
This commit is contained in:
parent
6efcfb4616
commit
7b01eea5e7
21
src/mu-cmd.c
21
src/mu-cmd.c
|
@ -322,6 +322,7 @@ _cmd_find (MuConfigOptions *opts)
|
||||||
|
|
||||||
xapian = mu_query_xapian_new (opts->xpath);
|
xapian = mu_query_xapian_new (opts->xpath);
|
||||||
if (!xapian) {
|
if (!xapian) {
|
||||||
|
g_warning ("Failed to create Xapian query");
|
||||||
mu_msg_gmime_uninit ();
|
mu_msg_gmime_uninit ();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -392,12 +393,18 @@ _cmd_index (MuConfigOptions *opts)
|
||||||
{
|
{
|
||||||
MuIndex *midx;
|
MuIndex *midx;
|
||||||
MuIndexStats stats;
|
MuIndexStats stats;
|
||||||
|
|
||||||
|
mu_index_stats_clear (&stats);
|
||||||
|
midx = mu_index_new (opts->xpath);
|
||||||
|
|
||||||
|
if (!midx) {
|
||||||
|
g_warning ("Indexing failed");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
g_message ("Indexing messages from %s", opts->maildir);
|
g_message ("Indexing messages from %s", opts->maildir);
|
||||||
g_message ("Database: %s", opts->xpath);
|
g_message ("Database: %s", opts->xpath);
|
||||||
|
|
||||||
mu_index_stats_clear (&stats);
|
|
||||||
midx = mu_index_new (opts->xpath);
|
|
||||||
rv = mu_index_run (midx, opts->maildir,
|
rv = mu_index_run (midx, opts->maildir,
|
||||||
opts->reindex, &stats,
|
opts->reindex, &stats,
|
||||||
opts->quiet ? NULL : _index_msg_cb,
|
opts->quiet ? NULL : _index_msg_cb,
|
||||||
|
@ -515,10 +522,16 @@ _cmd_cleanup (MuConfigOptions *opts)
|
||||||
MuIndex *midx;
|
MuIndex *midx;
|
||||||
MuIndexStats stats;
|
MuIndexStats stats;
|
||||||
|
|
||||||
|
mu_index_stats_clear (&stats);
|
||||||
|
|
||||||
|
midx = mu_index_new (opts->xpath);
|
||||||
|
if (!midx) {
|
||||||
|
g_warning ("Cleanup failed");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
g_message ("Cleaning up removed messages from %s",
|
g_message ("Cleaning up removed messages from %s",
|
||||||
opts->xpath);
|
opts->xpath);
|
||||||
mu_index_stats_clear (&stats);
|
|
||||||
midx = mu_index_new (opts->xpath);
|
|
||||||
mu_index_cleanup (midx, &stats,
|
mu_index_cleanup (midx, &stats,
|
||||||
opts->quiet ? NULL :_cleanup_cb,
|
opts->quiet ? NULL :_cleanup_cb,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
Loading…
Reference in New Issue