aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--database.cc2
-rw-r--r--notmuch.c8
3 files changed, 11 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 894874ae..f1057616 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
PROGS=notmuch
-CXXWARNINGS_FLAGS=-Wall -Wextra -Wmissing-declarations -Wwrite-strings
+CXXWARNINGS_FLAGS=-Wall -Wextra -Wmissing-declarations -Wwrite-strings \
+-Wswitch-enum
CWARNINGS_FLAGS=$(CXXWARNINGS_FLAGS)
CDEPENDS_FLAGS=`pkg-config --cflags glib-2.0 talloc`
diff --git a/database.cc b/database.cc
index e1ea324d..b1b95e9d 100644
--- a/database.cc
+++ b/database.cc
@@ -152,6 +152,8 @@ notmuch_status_to_string (notmuch_status_t status)
switch (status) {
case NOTMUCH_STATUS_SUCCESS:
return "No error occurred";
+ case NOTMUCH_STATUS_OUT_OF_MEMORY:
+ return "Out of memory";
case NOTMUCH_STATUS_XAPIAN_EXCEPTION:
return "A Xapian exception occurred";
case NOTMUCH_STATUS_FILE_ERROR:
diff --git a/notmuch.c b/notmuch.c
index ef93ded9..fbd773d7 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -267,10 +267,16 @@ add_files_recursive (notmuch_database_t *notmuch,
break;
/* Fatal issues. Don't process anymore. */
case NOTMUCH_STATUS_XAPIAN_EXCEPTION:
- fprintf (stderr, "A Xapian error was encountered. Halting processing.\n");
+ case NOTMUCH_STATUS_OUT_OF_MEMORY:
+ fprintf (stderr, "Error: %s. Halting processing.\n",
+ notmuch_status_to_string (status));
ret = status;
goto DONE;
default:
+ case NOTMUCH_STATUS_FILE_ERROR:
+ case NOTMUCH_STATUS_NULL_POINTER:
+ case NOTMUCH_STATUS_TAG_TOO_LONG:
+ case NOTMUCH_STATUS_LAST_STATUS:
INTERNAL_ERROR ("add_message returned unexpected value: %d", status);
goto DONE;
}