Usage after database close

David Bremner david at tethera.net
Mon Jun 29 07:39:02 PDT 2020


David Bremner <david at tethera.net> writes:

> David Bremner <david at tethera.net> writes:
>
>
>>> But part of my question is, *should* this be improved?  Am I
>>> interpreting notmuch's intended API correctly?
>>
>> Well, I agree you should get NOTMUCH_STATUS_XAPIAN_EXCEPTION back, or we
>> should change the docs to say "just don't do that".
>
> Arguments in favour of the latter:
>
> 1) several API calls don't return notmuch_status_t, so can't literally
>    return NOTMUCH_STATUS_XAPIAN_EXCEPTION
>
> 2) notmuch_message_get_{message,thread}_id promise never to return NULL,
>    has no way to report errors.
>
> I think it would probably make sense to say (if notmuch_database_reopen)
> existed, that if you call notmuch_database_close, don't call anything
> else except notmuch_database_reopen or notmuch_database_destroy.

I belatedly realized the exception is being caught, but then because of
a lack of an error path (and presumably thinking this error was unlikely
/ impossible), INTERNAL_ERROR is called. This is not great for bindings
either.

Regardless of how the API docs are updated, the current calling of
INTERNAL_ERROR should be avoided. I think I know what to do, it's just a
matter doing so with a sensible amount of boilerplate and changes.

d


More information about the notmuch mailing list