notmuch/test/symbol-test.cc
Austin Clements 5fddc07dc3 lib/cli: Make notmuch_database_open return a status code
It has been a long-standing issue that notmuch_database_open doesn't
return any indication of why it failed.  This patch changes its
prototype to return a notmuch_status_t and set an out-argument to the
database itself, like other functions that return both a status and an
object.

In the interest of atomicity, this also updates every use in the CLI
so that notmuch still compiles.  Since this patch does not update the
bindings, the Python bindings test fails.
2012-05-05 10:11:57 -03:00

18 lines
394 B
C++

#include <stdio.h>
#include <xapian.h>
#include <notmuch.h>
int main() {
notmuch_database_t *notmuch;
notmuch_database_open("fakedb", NOTMUCH_DATABASE_MODE_READ_ONLY, &notmuch);
try {
(void) new Xapian::WritableDatabase("./nonexistant", Xapian::DB_OPEN);
} catch (const Xapian::Error &error) {
printf("caught %s\n", error.get_msg().c_str());
return 0;
}
return 1;
}