compact: catch Xapian::Error consistently
authorTomi Ollila <tomi.ollila@iki.fi>
Wed, 13 Nov 2013 17:02:44 +0000 (19:02 +0200)
committerDavid Bremner <david@tethera.net>
Mon, 18 Nov 2013 00:25:43 +0000 (20:25 -0400)
catch Xapian::Error in compact code in lib/database.cc to be consistent
with other code in addition to not making software crash on uncaught
other Xapian error.

lib/database.cc

index 3c008d68da777a4b3324e2bb2359500ef74e37e8..3530cb650afba31748ea6fe9a15221fd8943ba16 100644 (file)
@@ -918,8 +918,8 @@ notmuch_database_compact (const char *path,
        compactor.add_source (xapian_path);
        compactor.set_destdir (compact_xapian_path);
        compactor.compact ();
        compactor.add_source (xapian_path);
        compactor.set_destdir (compact_xapian_path);
        compactor.compact ();
-    } catch (Xapian::InvalidArgumentError e) {
-       fprintf (stderr, "Error while compacting: %s\n", e.get_msg().c_str());
+    } catch (const Xapian::Error &error) {
+       fprintf (stderr, "Error while compacting: %s\n", error.get_msg().c_str());
        ret = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
        goto DONE;
     }
        ret = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
        goto DONE;
     }