Re: [PATCH 0/5] promise: introduce promises to track success or error
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 20, 2024, 16:20 UTC
- Message-ID
- <xmqqa5nvumxx.fsf@gitster.g>
- In-Reply-To
- <ZdSYxF3Hd6Zqt3Wd@tanuki>
Patrick Steinhardt <ps@pks.im> writes:
Show 15 quoted lines
> While we're already at it throwing ideas around, I also have to wonder > whether this would be a long-term solution towards computer-friendly > errors. One of the problems we quite frequently hit in Gitaly is that we > are forced to parse error messages in order to figure out why exactly > something has failed. Needless to say, this is quite fragile and also > feels very wrong. > > Now if we had a more structured way to pass errors around this might > also enable us to convey more meaning to the caller of Git commands. In > a hypothetical world where all errors were using an explicit error type, > then this error type could eventually become richer and contain more > information that is relevant to the calling script. And if such rich > error information was available, then it would not be that far fetched > to ask Git to emit errors in a computer-parsable format like for example > JSON.
I do not know about the "JSON-parseable" part, but a structured error message, or even just a set of error codes that can be recorded in an index, might already be a great improvement.