From 59d2457bcc5e19f287006cea8da0c7c7a003200d Mon Sep 17 00:00:00 2001 From: Ali Polatel Date: Sat, 24 Sep 2011 15:54:45 +0300 Subject: [PATCH] ruby: New exception Notmuch::UnbalancedAtomicError This exception wraps NOTMUCH_STATUS_UNBALANCED_ATOMIC which was added with the commit e59cc0031fbf84f49e32dedb9927f427d2c49309. --- bindings/ruby/defs.h | 1 + bindings/ruby/init.c | 9 ++++++++- bindings/ruby/status.c | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h index a0303169..5446868e 100644 --- a/bindings/ruby/defs.h +++ b/bindings/ruby/defs.h @@ -44,6 +44,7 @@ VALUE notmuch_rb_eFileNotEmailError; VALUE notmuch_rb_eNullPointerError; VALUE notmuch_rb_eTagTooLongError; VALUE notmuch_rb_eUnbalancedFreezeThawError; +VALUE notmuch_rb_eUnbalancedAtomicError; ID ID_call; ID ID_db_create; diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c index a516ab98..72e1a478 100644 --- a/bindings/ruby/init.c +++ b/bindings/ruby/init.c @@ -166,7 +166,14 @@ Init_notmuch(void) */ notmuch_rb_eUnbalancedFreezeThawError = rb_define_class_under(mod, "UnbalancedFreezeThawError", notmuch_rb_eBaseError); - + /* + * Document-class: Notmuch::UnbalancedAtomicError + * + * Raised when notmuch_database_end_atomic has been called more times than + * notmuch_database_begin_atomic + */ + notmuch_rb_eUnbalancedAtomicError = rb_define_class_under(mod, "UnbalancedAtomicError", + notmuch_rb_eBaseError); /* * Document-class: Notmuch::Database * diff --git a/bindings/ruby/status.c b/bindings/ruby/status.c index 3d106ca9..a2bd61a7 100644 --- a/bindings/ruby/status.c +++ b/bindings/ruby/status.c @@ -43,6 +43,8 @@ notmuch_rb_status_raise(notmuch_status_t status) rb_raise(notmuch_rb_eTagTooLongError, "tag too long"); case NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW: rb_raise(notmuch_rb_eUnbalancedFreezeThawError, "unbalanced freeze/thaw"); + case NOTMUCH_STATUS_UNBALANCED_ATOMIC: + rb_raise(notmuch_rb_eUnbalancedAtomicError, "unbalanced atomic"); default: rb_raise(notmuch_rb_eBaseError, "unknown notmuch error"); }