Thread (25 messages) flat view 25 messages, 7 authors, 2016-06-15

Re: [PATCH v5 1/5] setup: add gentle version of read_gitfile

From: Jeff King <hidden>
Date: 2016-06-15 23:04:34

Possibly related (same subject, not in this thread)

On Tue, Apr 28, 2015 at 01:34:00PM -0700, Jonathan Nieder wrote:
Jeff King wrote:
quoted
On Tue, Apr 28, 2015 at 10:07:43PM +0200, erik elfström wrote:
quoted
quoted
Also if it turns out that we actually need to treat the "file too
large" error differently in clean (as discussed in thread on the file
size check) then we can no longer communicate that back using the
strbuf interface.
Yeah, agreed. This system breaks down as soon as you need to
programatically know which error happened.
On the contrary: it separates the information that is used
programatically and the information intended for the user.

The return value (or an int * parameter) distinguishes errors that
affect control flow.  A string can provide information for the user.

This way it is easy to tweak the information that the user sees in
one place, without changing control flow.
But the NULL does not carry the information about _which_ error, and
Erik is suggesting that the caller may need to change behavior based on
that information. IOW, his current patch (return NULL and set the
specific integer code in a variable) allows this, but switching the
integer code out for a human-readable strbuf does not.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help