Redo error-formatting utilities to be a bit more idiomatic
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 1.3k
- Forks
- 144
- Avg merge
- 4h 50m
- Merged PRs (30d)
- 1
Description
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in generate/errors.go and inspect how errorf wraps errors and records positions. Compare the current output with the TestGenerateErrors-BindingWithIncorrectSelection-graphql snapshot, then determine which of the proposed formatting approaches best preserves structured positions and idiomatic wrapping. Done means the utility's behavior and affected snapshot output are consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, graphql
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100