Re: DatabaseModifiedErrors causing troubles

Subject: Re: DatabaseModifiedErrors causing troubles

Date: Sat, 17 Jan 2015 13:29:31 +0100

To: Gaute Hope, notmuch


From: David Bremner

Gaute Hope <> writes:

> 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.

I don't agree it's worse than the current situation but I take your
point it isn't ideal.  We could do some kind "errno" in the database
structure.  I think there are not that many functions with this
unhelpful error return type. Based on a scan of notmuch.h, I see


and the two count functions that I already posted API breaking patches
for.  It might be better just to update the API (either adding versions
with error returns, or just forcing people to change) for these
functions.  Otherwise we have two different ways of returning status
codes, and the "errno" is only used some of the time.