Thread (1 message) 1 message, 1 author, 2016-09-15

Re: [PATCH v7 04/10] pkt-line: add packet_flush_gently()

From: Junio C Hamano <hidden>
Date: 2016-09-15 20:33:51

Lars Schneider [off-list ref] writes:
quoted
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.
quoted
 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
got).
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help