unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH v2 02/11] lib: construct compactor within try block to catch any exceptions
Date: Sun,  3 Nov 2013 14:24:42 +0200	[thread overview]
Message-ID: <27c1f09763c60c9ec9791b066756608108e49539.1383481295.git.jani@nikula.org> (raw)
In-Reply-To: <cover.1383481295.git.jani@nikula.org>
In-Reply-To: <cover.1383481295.git.jani@nikula.org>

Constructors may also throw exceptions. Catch them.
---
 lib/database.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/database.cc b/lib/database.cc
index 20e5ec2..3dfea0f 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -864,7 +864,6 @@ notmuch_database_compact (const char* path,
 			  notmuch_compact_status_cb_t status_cb)
 {
     void *local = talloc_new (NULL);
-    NotmuchCompactor compactor(status_cb);
     char *notmuch_path, *xapian_path, *compact_xapian_path;
     char *old_xapian_path = NULL;
     notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;
@@ -910,6 +909,8 @@ notmuch_database_compact (const char* path,
     }
 
     try {
+	NotmuchCompactor compactor(status_cb);
+
 	compactor.set_renumber(false);
 	compactor.add_source(xapian_path);
 	compactor.set_destdir(compact_xapian_path);
-- 
1.8.4.rc3

  parent reply	other threads:[~2013-11-03 12:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-03 12:24 [PATCH v2 00/11] compactor changes v2 Jani Nikula
2013-11-03 12:24 ` [PATCH v2 01/11] test: fix compact backup / restore test Jani Nikula
2013-11-03 12:24 ` Jani Nikula [this message]
2013-11-03 12:24 ` [PATCH v2 03/11] lib: check talloc success in compact Jani Nikula
2013-11-06 21:56   ` David Bremner
2013-11-03 12:24 ` [PATCH v2 04/11] lib: do not leak the database in compaction Jani Nikula
2013-11-03 12:24 ` [PATCH v2 05/11] lib: add closure parameter to compact status update callback Jani Nikula
2013-11-03 12:24 ` [PATCH v2 06/11] lib: update documentation of callback functions for database_compact and database_upgrade Jani Nikula
2013-11-03 12:24 ` [PATCH v2 07/11] lib: use the compaction backup path provided by the caller Jani Nikula
2013-11-05 10:54   ` David Bremner
2013-11-05 11:15     ` Jani Nikula
2013-11-03 12:24 ` [PATCH v2 08/11] cli: return error status if compaction fails Jani Nikula
2013-11-03 12:24 ` [PATCH v2 09/11] cli: add compact --backup=DIRECTORY option, don't backup by default Jani Nikula
2013-11-07 11:07   ` David Bremner
2013-11-03 12:24 ` [PATCH v2 10/11] cli: add compact --verbose option and silence output without it Jani Nikula
2013-11-06 16:38   ` [PATCH 1/2] cli: add compact --quiet option and silence output with it Jani Nikula
2013-11-06 16:38     ` [PATCH 2/2] man: document notmuch compact --quiet and --backup=DIRECTORY options Jani Nikula
2013-11-07 13:25       ` Tomi Ollila
2013-11-07 23:30     ` [PATCH 1/2] cli: add compact --quiet option and silence output with it David Bremner
2013-11-03 12:24 ` [PATCH v2 11/11] man: document notmuch compact --verbose and --backup=DIRECTORY options Jani Nikula
2013-11-05 11:05 ` [PATCH v2 00/11] compactor changes v2 David Bremner
2013-11-05 18:50   ` Tomi Ollila
2013-11-05 19:26     ` Ben Gamari
2013-11-05 20:14       ` Tomi Ollila
2013-11-05 18:48 ` Ben Gamari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27c1f09763c60c9ec9791b066756608108e49539.1383481295.git.jani@nikula.org \
    --to=jani@nikula.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).