--- /dev/null
+Return-Path: <novalazy@gmail.com>\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 944ED431FD8\r
+ for <notmuch@notmuchmail.org>; Wed, 16 Apr 2014 06:00:17 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, 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 oRmfF7ICliGT for <notmuch@notmuchmail.org>;\r
+ Wed, 16 Apr 2014 06:00:12 -0700 (PDT)\r
+Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com\r
+ [209.85.220.52]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id D3ADB431FBF\r
+ for <notmuch@notmuchmail.org>; Wed, 16 Apr 2014 05:59:54 -0700 (PDT)\r
+Received: by mail-pa0-f52.google.com with SMTP id rd3so10871433pab.25\r
+ for <notmuch@notmuchmail.org>; Wed, 16 Apr 2014 05:59:54 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+ bh=ysDXZYN1HSpqRnTThvM90TRhsDZIjKzf1KldDFF1sXk=;\r
+ b=ROPpKGs/UmEOoGD7GEzp3L0kdxsaN3Y3SV83+/sy6TXycYukMllXUJXBbtdVCUkL13\r
+ BotG0M+fvq1YXZ4pYFNbtWiMBjKdm2bYc+NIwhRUNN5YD/rN3vS0gHwIwW60O7DyWYau\r
+ f7IRdcucurg6UMW0FB+JZGZW8JFNSa4vm/Nr2kRQ84+mpP9k0Rr7AxezsEq4iDvW8eNl\r
+ fHXQe0sAJZs2rL2itDk01aVTyrfovaEboB1ejfquqNQ8gOrENmSVJ2vaGD0WAEJWYOkS\r
+ JsTNYHwnK10eHYxm13iwgspPrJIx+8bWpqOQzrMZO/0Op7Pl11iZ5bq/QsmveV9ATTM9\r
+ X05w==\r
+X-Received: by 10.68.197.99 with SMTP id it3mr8230605pbc.37.1397653194096;\r
+ Wed, 16 Apr 2014 05:59:54 -0700 (PDT)\r
+Received: from localhost (215.42.233.220.static.exetel.com.au.\r
+ [220.233.42.215]) by mx.google.com with ESMTPSA id\r
+ id10sm46933724pbc.35.2014.04.16.05.59.51 for <multiple recipients>\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Wed, 16 Apr 2014 05:59:52 -0700 (PDT)\r
+From: Peter Wang <novalazy@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 03/10] python: handle return status of database close and\r
+ destroy\r
+Date: Wed, 16 Apr 2014 22:59:18 +1000\r
+Message-Id: <1397653165-15620-4-git-send-email-novalazy@gmail.com>\r
+X-Mailer: git-send-email 1.8.4\r
+In-Reply-To: <1397653165-15620-1-git-send-email-novalazy@gmail.com>\r
+References: <1397653165-15620-1-git-send-email-novalazy@gmail.com>\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: Wed, 16 Apr 2014 13:00:17 -0000\r
+\r
+Throw an exception if notmuch_database_close or notmuch_database_destroy\r
+fail.\r
+---\r
+ bindings/python/notmuch/database.py | 12 ++++++++----\r
+ 1 file changed, 8 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py\r
+index 7ddf5cf..5b58e09 100644\r
+--- a/bindings/python/notmuch/database.py\r
++++ b/bindings/python/notmuch/database.py\r
+@@ -157,11 +157,13 @@ class Database(object):\r
+ \r
+ _destroy = nmlib.notmuch_database_destroy\r
+ _destroy.argtypes = [NotmuchDatabaseP]\r
+- _destroy.restype = None\r
++ _destroy.restype = c_uint\r
+ \r
+ def __del__(self):\r
+ if self._db:\r
+- self._destroy(self._db)\r
++ status = self._destroy(self._db)\r
++ if status != STATUS.SUCCESS:\r
++ raise NotmuchError(status)\r
+ \r
+ def _assert_db_is_initialized(self):\r
+ """Raises :exc:`NotInitializedError` if self._db is `None`"""\r
+@@ -217,7 +219,7 @@ class Database(object):\r
+ \r
+ _close = nmlib.notmuch_database_close\r
+ _close.argtypes = [NotmuchDatabaseP]\r
+- _close.restype = None\r
++ _close.restype = c_uint\r
+ \r
+ def close(self):\r
+ '''\r
+@@ -231,7 +233,9 @@ class Database(object):\r
+ NotmuchError.\r
+ '''\r
+ if self._db:\r
+- self._close(self._db)\r
++ status = self._close(self._db)\r
++ if status != STATUS.SUCCESS:\r
++ raise NotmuchError(status)\r
+ \r
+ def __enter__(self):\r
+ '''\r
+-- \r
+1.8.4\r
+\r