99designs / 99designs/gqlgen

Use errors.Join instead of multierror.Append

オープン
#3,000 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Go
スター
10.8k
フォーク
1.3k
平均マージ
2日 36分
マージ済み PR(30日)
26

説明

### What happened?

In gql_node.go:

```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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。