Khan / Khan/genqlient

Redo error-formatting utilities to be a bit more idiomatic

Open
#118 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue help wanted internal
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.