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

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

Date: Sat, 21 Oct 2017 08:53:56 -0300

To: Jani Nikula, notmuch@notmuchmail.org

Cc:

From: David Bremner


Jani Nikula <jani@nikula.org> writes:

> On Tue, 17 Oct 2017, David Bremner <david@tethera.net> wrote:
>> Jani Nikula <jani@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++.


_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: