Re: DatabaseModifiedErrors causing troubles

Subject: Re: DatabaseModifiedErrors causing troubles

Date: Sat, 17 Jan 2015 11:18:43 +0000

To: David Bremner, notmuch


From: Gaute Hope

Excerpts from David Bremner's message of December 31, 2014 9:28:
> Gaute Hope <> writes:
>> I can work around this by checking for a NULL pointer returned from
>> notmuch_query_search_threads () and re-open the database
>> (notmuch_database_close () -> notmuch_database_open ()). But I have no
>> way of knowing programatically if this really is the error that has
>> happened. There should be some way of propagating the error
>> information or (even better for my case; for notmuch to reopen the
>> database), one option is the Gmime way of passing an pointer to an
>> error structure that is filled up by the notmuch interface function.
> Hi Gaute;
> Sorry this sequence of postings of yours kindof fell down a well. In
> general there seems to be not very much enthusiasm for the GError
> solution.  We can do something less fancy with the series at
> In particular
> replaces the printfs with saving to a status string accessible from
> notmuch_database_t.

Hi David,

Would it be possible with an error code that I could compare against in
stead? It would then work a bit like a global instance of the gmime
error. It could even be a preparation step against a gmime-error-style
solution in the far future.

I am sure you know all the bad reasons for using a strcmp with strings
such as small (subtle) changes making them useless or future
localization of notmuch. This solution is in my opinion worse than the
current situation, it will lock things in and create problems for future
API compatability and application maintainers. I would rather wait for
or spend some time on a more general solution.

Best regards, Gaute

> I _think_ this could solve your problem, although doing strcmp on error
> message might not be ideal. Overall this is much less api breakage
> (only open and create need to be wrapped).
> We could also consider really updating the api for those NULL returning
> functions, but it seems less bad to me than the count functions updated
> in this series
> Let me know what you think,
> David