notmuch/bindings/ruby/status.c

52 lines
1.9 KiB
C
Raw Normal View History

2010-05-22 07:45:40 +02:00
/* The Ruby interface to the notmuch mail library
*
* Copyright © 2010, 2011 Ali Polatel
2010-05-22 07:45:40 +02:00
*
* 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 https://www.gnu.org/licenses/ .
2010-05-22 07:45:40 +02:00
*
* Author: Ali Polatel <alip@exherbo.org>
*/
#include "defs.h"
void
notmuch_rb_status_raise (notmuch_status_t status)
2010-05-22 07:45:40 +02:00
{
switch (status) {
case NOTMUCH_STATUS_SUCCESS:
case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:
break;
2010-05-22 07:45:40 +02:00
case NOTMUCH_STATUS_OUT_OF_MEMORY:
rb_raise (notmuch_rb_eMemoryError, "out of memory");
2010-05-22 07:45:40 +02:00
case NOTMUCH_STATUS_READ_ONLY_DATABASE:
rb_raise (notmuch_rb_eReadOnlyError, "read-only database");
2010-05-22 07:45:40 +02:00
case NOTMUCH_STATUS_XAPIAN_EXCEPTION:
rb_raise (notmuch_rb_eXapianError, "xapian exception");
2010-05-22 07:45:40 +02:00
case NOTMUCH_STATUS_FILE_ERROR:
rb_raise (notmuch_rb_eFileError, "failed to read/write file");
2010-05-22 07:45:40 +02:00
case NOTMUCH_STATUS_FILE_NOT_EMAIL:
rb_raise (notmuch_rb_eFileNotEmailError, "file not email");
2010-05-22 07:45:40 +02:00
case NOTMUCH_STATUS_NULL_POINTER:
rb_raise (notmuch_rb_eNullPointerError, "null pointer");
2010-05-22 07:45:40 +02:00
case NOTMUCH_STATUS_TAG_TOO_LONG:
rb_raise (notmuch_rb_eTagTooLongError, "tag too long");
2010-05-22 07:45:40 +02:00
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");
2010-05-22 07:45:40 +02:00
default:
rb_raise (notmuch_rb_eBaseError, "unknown notmuch error");
2010-05-22 07:45:40 +02:00
}
}