[PATCH v2 05/10] ruby: handle return status of database close

Subject: [PATCH v2 05/10] ruby: handle return status of database close

Date: Wed, 16 Apr 2014 22:59:20 +1000

To: notmuch@notmuchmail.org

Cc:

From: Peter Wang


Throw an exception if notmuch_database_destroy fails.
---
 bindings/ruby/database.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c
index e84f726..c03d701 100644
--- a/bindings/ruby/database.c
+++ b/bindings/ruby/database.c
@@ -113,11 +113,13 @@ notmuch_rb_database_open (int argc, VALUE *argv, VALUE klass)
 VALUE
 notmuch_rb_database_close (VALUE self)
 {
+    notmuch_status_t ret;
     notmuch_database_t *db;
 
     Data_Get_Notmuch_Database (self, db);
-    notmuch_database_destroy (db);
+    ret = notmuch_database_destroy (db);
     DATA_PTR (self) = NULL;
+    notmuch_rb_status_raise (ret);
 
     return Qnil;
 }
-- 
1.8.4


Thread: