You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(factory): add 99designs/gqlgen contrib with a boost-error ErrorPresenter (GraphQL = 4th transport) #44
boost maps its typed-error catalog to a transport code automatically on three edges:
Echo error_handler → HTTP status
gRPC server → codes.Code
function / CloudEvents → deadletter / status
GraphQL is the gap. With 99designs/gqlgen, a resolver error is caught by gqlgen, run through its ErrorPresenter, and written as HTTP 200 with the error inside the errors[] array. The Echo error_handler never sees it, so the public extensions.code is not derived from the boost catalog — every service hand-rolls its own presenter.
Proposal
Ship a factory/contrib/99designs/gqlgen/v0 package providing a ready boost-aware ErrorPresenter (and optionally a thin server constructor mirroring the other factories) that:
Walks the stdlib error chain (boost typed errors now implement Unwrap()).
Maps the boost catalog → a stable extensions.code via the same classification the other transports use:
once the error registry (Classify / Kind, branch feat/error-registry) lands → a Kind → code table, sibling to restresponse.HTTPStatusFor and the gRPC Kind → codes.Code table;
Never leaks internals for Internal / ServiceUnavailable (safe message).
Honors IgnoreOf (registry) the same way the other edges do.
This makes GraphQL the 4th transport over the single boost error catalog — srv.SetErrorPresenter(gqlgenfact.ErrorPresenter) and resolvers keep returning boost typed errors.
Notes / open questions
Dependency surface: adds github.com/99designs/gqlgen + github.com/vektah/gqlparser/v2. Suggest isolating it as its own contrib module (own go.mod) so boost core doesn't take the dep, consistent with the other factory/contrib/*.
The code-string set should be exported + overridable (each service maps to its own public GraphQL contract).
Reference pattern is already documented in the boost-model-errors skill → section "GraphQL transport — gqlgen ErrorPresenter".
Related: Err.Unwrap() (stdlib errors.Is/As transparency) already landed on main.
Acceptance
factory/contrib/99designs/gqlgen/v0 with ErrorPresenter (+ tests) mapping the boost catalog → extensions.code
Honors the error registry Classify / IgnoreOf once available
Exported, overridable code strings
Docs/skill (boost-model-errors and/or a new boost-factory-gqlgen) updated
Activity