[PATCH] lib: add support for thread:<message-id> queries

David Bremner david at tethera.net
Sat Oct 21 04:53:56 PDT 2017


Jani Nikula <jani at nikula.org> writes:

> On Tue, 17 Oct 2017, David Bremner <david at tethera.net> wrote:
>> Jani Nikula <jani at nikula.org> writes:
>>
>> The other field processors throw Xapian::QueryParserErrors in case bad
>> things happen (e.g. failure to read from the database). This seems to be
>> better than nothing as it allows transmitting some detail to the
>> user. See e.g. "regex error reporting" in test/T650-regexp-query.sh. And
>> of course, speaking of tests, this should have one.
>
> I'm not sure what you're suggesting. Do you mean I should open-code
> notmuch_database_find_message() or notmuch_message_get_thread_id() to
> get at the exceptions thrown within them?
>
> BR,
> Jani.

nothing so fancy. Consider the following bit of query-fp.cc

    status = notmuch_database_get_config (notmuch, key.c_str (), &expansion);
    if (status) {
	throw Xapian::QueryParserError ("error looking up key" + name);
    }


That could no doubt be improved to report the specifics of `status`, but
it's already better than silently ignoring the error, as this will
eventually be reported back to library clients. I agree the exception ->
error-code -> exception -> error-code  path is pretty gross, but thats
the price we pay for mostly pretending we're not writing C++.




More information about the notmuch mailing list