gqlgen
gqlgen copied to clipboard
Use errors.Join instead of multierror.Append
What happened?
In gql_node.go:
func (c *Client) Noder(ctx context.Context, id int, opts ...NodeOption) (_ Noder, err error) {
defer func() {
if IsNotFound(err) {
err = multierror.Append(err, entgql.ErrNodeNotFound(id))
}
}()
table, err := c.newNodeOpts(opts).nodeType(ctx, id)
if err != nil {
return nil, err
}
return c.noder(ctx, table, id)
}
// ...
func (c *Client) Noders(ctx context.Context, ids []int, opts ...NodeOption) ([]Noder, error) {
// ...
for i, id := range ids {
if errors[i] == nil {
if noders[i] != nil {
continue
}
errors[i] = entgql.ErrNodeNotFound(id)
} else if IsNotFound(errors[i]) {
errors[i] = multierror.Append(errors[i], entgql.ErrNodeNotFound(id))
}
ctx := graphql.WithPathContext(ctx,
graphql.NewPathWithIndex(i),
)
graphql.AddError(ctx, errors[i])
}
// ...
}
What did you expect?
Use errors.Join instead.
Minimal graphql.schema and models to reproduce
I think it's always there?
versions
-
go run github.com/99designs/gqlgen version? v0.17.45 -
go version? go version go1.22.2 darwin/arm64