[PATCH v2 02/11] lib: construct compactor within try block to catch any exceptions
authorJani Nikula <jani@nikula.org>
Sun, 3 Nov 2013 12:24:42 +0000 (14:24 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:57 +0000 (09:57 -0800)
94/c4a0d7b2b067a67e6a9e6179c913ad4cbb4300 [new file with mode: 0644]

diff --git a/94/c4a0d7b2b067a67e6a9e6179c913ad4cbb4300 b/94/c4a0d7b2b067a67e6a9e6179c913ad4cbb4300
new file mode 100644 (file)
index 0000000..e72fef7
--- /dev/null
@@ -0,0 +1,100 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id A8CF7429E39\r
+       for <notmuch@notmuchmail.org>; Sun,  3 Nov 2013 04:25:13 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id hCq9ckAq9qcM for <notmuch@notmuchmail.org>;\r
+       Sun,  3 Nov 2013 04:25:06 -0800 (PST)\r
+Received: from mail-ea0-f181.google.com (mail-ea0-f181.google.com\r
+       [209.85.215.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 755AE431FCB\r
+       for <notmuch@notmuchmail.org>; Sun,  3 Nov 2013 04:25:00 -0800 (PST)\r
+Received: by mail-ea0-f181.google.com with SMTP id d10so2908743eaj.12\r
+       for <notmuch@notmuchmail.org>; Sun, 03 Nov 2013 04:24:59 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=1e100.net; s=20130820;\r
+       h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+       :references:in-reply-to:references;\r
+       bh=HDt7xBQIHRZ5pkmnXu/Yo5o9jor6sS7ZoHvjffwwkVk=;\r
+       b=M7FBzMfeKW9NQMHiQgVI5UvahPOGJ7LVjAJXDj6eC5M1Uiy6w3i/1FyP1W2OgNcVVZ\r
+       zzz8bqO4GiXhNNtGvUjWiHfzYOB0YCBSGEL4te4ivxlqUH2IJ2aq8Bjd1GS8i86vYVRO\r
+       qiirdKnil6JXfh4fAWvtKRi81GRLimMUNyAt/FbvasYDNpaUj7LxhgEH7YHBVbgzVSNj\r
+       N/+0T83GZwHmKiE7S1CHQ6GW9T14a1zj/VDAnsJDIshZ429s0j3yk9PUyp3sqnKvXaqp\r
+       zfIhFH55kZoZZlTPotbNMdiYCkHASJjm/SB2ABsrrwIOioQ9xlxZkIKT7j/mR9+7G2tF\r
+       1u+w==\r
+X-Gm-Message-State:\r
+ ALoCoQmKOCsezKOkSazSDLRjXeqsNgXal9yAjZx25wDSo2g5ytSuSko72QXaq7VMnsYQ73LJ5qLJ\r
+X-Received: by 10.14.32.196 with SMTP id o44mr2326162eea.43.1383481499294;\r
+       Sun, 03 Nov 2013 04:24:59 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+       [88.195.111.91])\r
+       by mx.google.com with ESMTPSA id 8sm1246954eem.15.2013.11.03.04.24.57\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sun, 03 Nov 2013 04:24:58 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 02/11] lib: construct compactor within try block to catch\r
+       any exceptions\r
+Date: Sun,  3 Nov 2013 14:24:42 +0200\r
+Message-Id:\r
+ <27c1f09763c60c9ec9791b066756608108e49539.1383481295.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.8.4.rc3\r
+In-Reply-To: <cover.1383481295.git.jani@nikula.org>\r
+References: <cover.1383481295.git.jani@nikula.org>\r
+In-Reply-To: <cover.1383481295.git.jani@nikula.org>\r
+References: <cover.1383481295.git.jani@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 03 Nov 2013 12:25:14 -0000\r
+\r
+Constructors may also throw exceptions. Catch them.\r
+---\r
+ lib/database.cc | 3 ++-\r
+ 1 file changed, 2 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index 20e5ec2..3dfea0f 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -864,7 +864,6 @@ notmuch_database_compact (const char* path,\r
+                         notmuch_compact_status_cb_t status_cb)\r
+ {\r
+     void *local = talloc_new (NULL);\r
+-    NotmuchCompactor compactor(status_cb);\r
+     char *notmuch_path, *xapian_path, *compact_xapian_path;\r
+     char *old_xapian_path = NULL;\r
+     notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;\r
+@@ -910,6 +909,8 @@ notmuch_database_compact (const char* path,\r
+     }\r
\r
+     try {\r
++      NotmuchCompactor compactor(status_cb);\r
++\r
+       compactor.set_renumber(false);\r
+       compactor.add_source(xapian_path);\r
+       compactor.set_destdir(compact_xapian_path);\r
+-- \r
+1.8.4.rc3\r
+\r