error handling and stderr

Justus Winter 4winter at informatik.uni-hamburg.de
Sun Jan 29 10:01:24 PST 2012


Hi notmuch developers,

currently there is no way to determine why opening a database using
notmuch_database_open fails. I suppose that this is a problem for all
functions returning a pointer, but it is especially problematic for
this function since one cannot distinguish between a temporary failure
(someone else opened the db read/write) and a configuration problem
(wrong path).

This is a real problem for providing sensible feedback to the user.

And writing an error message to stderr is a sensible thing to do if it
is done in a command line utility but doing so within a library is a
severe problem for any curses frontends and is generally considered a
bad practice.

For the record, libabcs README[0] agrees with me on both aspects.

Since fixing this means breaking the api we need to discuss this
thoroughly and identify all the functions involved.

Users of the python bindings won't be affected by an api change like
this since we're converting any error code to exceptions anyway.

Cheers,
Justus

0: https://git.kernel.org/?p=linux/kernel/git/kay/libabc.git;a=blob_plain;f=README


More information about the notmuch mailing list