ruby: handle return status of database close
authorPeter Wang <novalazy@gmail.com>
Wed, 16 Apr 2014 12:59:20 +0000 (22:59 +1000)
committerDavid Bremner <david@tethera.net>
Tue, 16 Sep 2014 18:17:15 +0000 (20:17 +0200)
Throw an exception if notmuch_database_destroy fails.

bindings/ruby/database.c

index e84f726d1bf5576814a019062e883e604f0ba467..c03d7011f8406931045183a02eeb0d1395eb0107 100644 (file)
@@ -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;
 }