- if (strlen (term) > NOTMUCH_TERM_MAX)
- return NOTMUCH_PRIVATE_STATUS_TERM_TOO_LONG;
-
- message->doc.add_term (term, 0);
- message->modified = true;
+ try {
+ message->doc.add_term (term, 0);
+ message->modified = true;
+ _notmuch_message_invalidate_metadata (message, prefix_name);
+ } catch (Xapian::Error &error) {
+ LOG_XAPIAN_EXCEPTION (message, error);
+ status = NOTMUCH_PRIVATE_STATUS_XAPIAN_EXCEPTION;
+ }