From 3f6a28bf815bd57219d7526ff29ea13ac75a4757 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Wed, 13 Nov 2013 19:02:44 +0200 Subject: [PATCH] [PATCH v2 2/5] compact: catch Xapian::Error consistently --- 1c/1887d987a692ea7814f6386ff519a5d6fc5496 | 69 +++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 1c/1887d987a692ea7814f6386ff519a5d6fc5496 diff --git a/1c/1887d987a692ea7814f6386ff519a5d6fc5496 b/1c/1887d987a692ea7814f6386ff519a5d6fc5496 new file mode 100644 index 000000000..86651cb38 --- /dev/null +++ b/1c/1887d987a692ea7814f6386ff519a5d6fc5496 @@ -0,0 +1,69 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 840AE431FD0 + for ; Wed, 13 Nov 2013 09:03:03 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id FzooEcyCI5sV for ; + Wed, 13 Nov 2013 09:02:56 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 035B1431FC7 + for ; Wed, 13 Nov 2013 09:02:55 -0800 (PST) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id 6AE6A1000F2; Wed, 13 Nov 2013 19:02:51 +0200 (EET) +From: Tomi Ollila +To: notmuch@notmuchmail.org +Subject: [PATCH v2 2/5] compact: catch Xapian::Error consistently +Date: Wed, 13 Nov 2013 19:02:44 +0200 +Message-Id: <1384362167-12740-3-git-send-email-tomi.ollila@iki.fi> +X-Mailer: git-send-email 1.8.0 +In-Reply-To: <1384362167-12740-1-git-send-email-tomi.ollila@iki.fi> +References: <1384362167-12740-1-git-send-email-tomi.ollila@iki.fi> +Cc: tomi.ollila@iki.fi +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 13 Nov 2013 17:03:03 -0000 + +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 | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/database.cc b/lib/database.cc +index 3c008d6..3530cb6 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -918,8 +918,8 @@ notmuch_database_compact (const char *path, + 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; + } +-- +1.8.3.1 + -- 2.26.2