Am 17.11.2017 um 23:33 schrieb Jeff King:
On Mon, Nov 06, 2017 at 05:13:15PM +0100, Simon Ruderich wrote:
On Sat, Nov 04, 2017 at 10:07:00PM -0400, Jeff King wrote:
Yes, I think what you've written here (and below) is quite close to the
error_context patches I linked elsewhere in the thread. In other
words, I think it's a sane approach.
In contrast to error_context I'd like to keep all exiting
behavior (die, ignore, etc.) in the hand of the caller and not
use any callbacks as that makes the control flow much harder to
follow.
Yeah, I have mixed feelings on that. I think it does make the control
flow less clear. At the same time, what I found was that handlers like
die/ignore/warn were the thing that gave the most reduction in
complexity in the callers.
Would you not consider switching over to C++? With exceptions, you get
the error context without cluttering the API. (Did I mention that
librarification would become a breeze? Do not die in library routines:
not a problem anymore, just catch the exception. die_on_error
parameters? Not needed anymore. Not to mention that resource leaks would
be much, MUCH simpler to treat.)
-- Hannes