On Fri, 30 Sep 2011 02:41:02 +0200, Justus Winter <firstname.lastname@example.org> wrote: Non-text part: multipart/mixed > Quoting Sebastian Spaeth (2011-09-29 09:45:38) > >Also, not all "status" are an error, e.g. DuplicateMessageId denotes > >success rather than failure, it just communicates a status. > > I just stumbled upon the following comment in notmuch.h: > > /* Status codes used for the return values of most functions. > * > * A zero value (NOTMUCH_STATUS_SUCCESS) indicates that the function > * completed without error. Any other value indicates an error as > * follows: > [...] That sounds like notmuch.h doesn't know what it wants :-). The "error" can occur on add_message or remove_message and notmuch.h has to say: on add_message: * If 'message' is not NULL, then, on successful return * (NOTMUCH_STATUS_SUCCESS or NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) '*message' * will be initialized to a message object that can be used for things * such as adding tags to the just-added message. The user should call * notmuch_message_destroy when done with the message. ... On any failure * '*message' will be set to NULL. So DUPLICATE_MESSAGE_ID is definitely a successful return here, filling in the Message object. on remove_message: * NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: This filename was removed but * the message persists in the database with at least one other * filename. Similarly, the operation succeeded, it's just that there are other messages with that ID still around. One could argue whether this is an error or not.