On Mon, Sep 30, 2024 at 10:03:52PM +0000, brian m. carlson wrote:
+ case GIT_ERR_MULTIPLE: + strbuf_addf(buf, _("multiple errors:\n")); + for (size_t i = 0; i < me->count; i++) { + git_error_strbuf(buf, me->errs[i]); + strbuf_addstr(buf, "\n"); + } + }
ah. i was wondering how you'd address this ("this" being non-fatal errors piling up), as i'm facing the same problem in a project of mine. the problem is that one can either impose a very rigid formatting (as you do here), or provide formatting options, which can get arbitrarily complex. so i wonder whether one shouldn't pursue a hybrid approach instead: singular return values for low-level functions that either work or fail fatally, and error callbacks for higher-level functionality? btw, the switch misses breaks.