Khan/genqlient

Redo error-formatting utilities to be a bit more idiomatic

Open

#118 geöffnet am 28. Sept. 2021

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)Go (141 Forks)github user discovery
good first issuehelp wantedinternal

Repository-Metriken

Stars
 (1.310 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

We have our own errorf (in generate/errors.go) so that we can do structured errors with positions. But our errorf is a bit un-idiomatic (which caused confusion in #117) -- it just wraps the first error argument it finds rather than using %w -- and it also doesn't actually format wrapped errors in a very good way (e.g. here). We could probably do better, either having our wrapper do an ordinary fmt.Errorf (by formatting the position at call-time), or by making it a bit more idiomatic and using its extra structure to hoist the position to the outermost error.

Contributor Guide