Re: [PATCH v5 1/5] setup: add gentle version of read_gitfile
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Apr 28, 2015, 20:34 UTC
- Message-ID
- <20150428203400.GN5467@google.com>
- In-Reply-To
- <20150428201918.GA10902@peff.net>
Jeff King wrote:
> On Tue, Apr 28, 2015 at 10:07:43PM +0200, erik elfström wrote:
Show 7 quoted lines
>> 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.