"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

Stefan Sperling <stsp@stsp.name>
Re: in diff error message, say what was being diffed
James Cook <falsifian@falsifian.org>
Mon, 18 Sep 2023 16:53:02 +0200

Download raw body.

On Mon, Sep 18, 2023 at 02:47:17PM +0000, James Cook wrote:
> On Mon, Sep 18, 2023 at 08:47:31AM +0200, Stefan Sperling wrote:
> > There is another function, called got_error_from_errno_fmt().
> > Would that one work?
> > In any case, I would rather tweak the existing error interfaces to
> > match our needs than add even more variants.
> The trouble with the from_errno variants is that at this point in
> dif_blob_file(), I've just got a generic struct got_error to work with, as
> returned by got_diffreg(). It's possible errno still has the original error
> in it, but even if it does, err->msg at this point contains
> 	diff_atomize_file: Cannot allocate memory
> and re-generating the error message will etiher lose the
> "diff_atomize_file:" part (if we ignore the existing err->msg) or duplicate
> the "Cannot allocate memory" part (if we wrap the existing err->msg and use
> one of the from_errno functions.

I see. No worries.
> This may be a sign that I'm deviating too much from existing coding style. I
> haven't seen any other places where an existing error message is "wrapped".
> I suppose another option would be to pass the
> error context to the got_diffreg() function, but that seems like
> overcomplicating things.
> Another possibility is to just drop the patch to avoid complicating things.

I was just trying to simplify your original diff. Since that does not (yet?)
succeed with the APIs we have, please put your original diff in. ok stsp