Lars Schneider <> writes:

>> So the "right" pattern is either:
>>  1. Return -1 and the caller is responsible for telling the user.

... which is valid only if there aren't different kinds of errors
that all return -1; with "return error(...)" with different
messages, the users can tell what kind of error they got (while the
caller may just do the same abort-procedure no matter what kind of
error it got), but if all of them are replaced with "return -1", the
caller cannot produce different error messages to tell the users.

>>  2. Return -1 and stuff the error into an error strbuf, so it can be
>>     passed up the call chain easily (and callers do not have to come up
>>     with their own wording).

... and this would become one of the viable options (the other is to
define your own error code so that the caller can tell what error it

>> But if all current callers would just call error() themselves anyway,
>> then it's OK to punt on this and let somebody else handle it later if
>> they add a new caller who wants different behavior (and that is what
>> Junio was saying above, I think).

Yes.  Just keeping it noisy until somebody wants a quiet-and-gentle
version is probably the best course to take.

Reply via email to