diff options
| author | Carl Worth <cworth@cworth.org> | 2010-11-08 10:08:27 -0800 |
|---|---|---|
| committer | Carl Worth <cworth@cworth.org> | 2010-11-08 10:08:34 -0800 |
| commit | 44ea57a0d10ddab514abea319c4d25ec4e36b51e (patch) | |
| tree | e2bf63e6c1f54b21650c51356b78b29042a56848 /bindings/ruby/status.c | |
| parent | dedd7918a33a002923954c1333bd6729cdc3d03f (diff) | |
| parent | 5c9e385591b66fa20cbb186393c48c52831a23b7 (diff) | |
Merge in ruby bindings.
Thanks to Ali Polatel for these bindings. This code was fetched from
the ruby branch of:
git://github.com/alip/notmuch.git
Diffstat (limited to 'bindings/ruby/status.c')
| -rw-r--r-- | bindings/ruby/status.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/bindings/ruby/status.c b/bindings/ruby/status.c new file mode 100644 index 00000000..3d106ca9 --- /dev/null +++ b/bindings/ruby/status.c @@ -0,0 +1,49 @@ +/* The Ruby interface to the notmuch mail library + * + * Copyright © 2010 Ali Polatel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ . + * + * Author: Ali Polatel <alip@exherbo.org> + */ + +#include "defs.h" + +void +notmuch_rb_status_raise(notmuch_status_t status) +{ + switch (status) { + case NOTMUCH_STATUS_SUCCESS: + case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: + break; + case NOTMUCH_STATUS_OUT_OF_MEMORY: + rb_raise(notmuch_rb_eMemoryError, "out of memory"); + case NOTMUCH_STATUS_READ_ONLY_DATABASE: + rb_raise(notmuch_rb_eReadOnlyError, "read-only database"); + case NOTMUCH_STATUS_XAPIAN_EXCEPTION: + rb_raise(notmuch_rb_eXapianError, "xapian exception"); + case NOTMUCH_STATUS_FILE_ERROR: + rb_raise(notmuch_rb_eFileError, "failed to read/write file"); + case NOTMUCH_STATUS_FILE_NOT_EMAIL: + rb_raise(notmuch_rb_eFileNotEmailError, "file not email"); + case NOTMUCH_STATUS_NULL_POINTER: + rb_raise(notmuch_rb_eNullPointerError, "null pointer"); + case NOTMUCH_STATUS_TAG_TOO_LONG: + rb_raise(notmuch_rb_eTagTooLongError, "tag too long"); + case NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW: + rb_raise(notmuch_rb_eUnbalancedFreezeThawError, "unbalanced freeze/thaw"); + default: + rb_raise(notmuch_rb_eBaseError, "unknown notmuch error"); + } +} |
