ruby: handle return status of database close

Throw an exception if notmuch_database_destroy fails.
This commit is contained in:
Peter Wang 2014-04-16 22:59:20 +10:00 committed by David Bremner
parent d81fc4b42d
commit 034102303e

View file

@ -113,11 +113,13 @@ notmuch_rb_database_open (int argc, VALUE *argv, VALUE klass)
VALUE VALUE
notmuch_rb_database_close (VALUE self) notmuch_rb_database_close (VALUE self)
{ {
notmuch_status_t ret;
notmuch_database_t *db; notmuch_database_t *db;
Data_Get_Notmuch_Database (self, db); Data_Get_Notmuch_Database (self, db);
notmuch_database_destroy (db); ret = notmuch_database_destroy (db);
DATA_PTR (self) = NULL; DATA_PTR (self) = NULL;
notmuch_rb_status_raise (ret);
return Qnil; return Qnil;
} }