Not possible to discern GraphQL scalar unmarshal errors in error presenter
- 主要言語
- Go
- スター
- 10.8k
- フォーク
- 1.3k
- 平均マージ
- 2日 36分
- マージ済み PR(30日)
- 26
説明
### What happened?
Errors occurring in packaged scalars like `Int` return unstructured `error`s making them difficult to identify in an [error presenter](https://gqlgen.com/reference/errors/#the-error-presenter).
See https://github.com/99designs/gqlgen/blob/414a4d3414b2b5856851816f0152980098f7b3ab/graphql/int.go#L16-L29 for example.
In our case, we catch any top level `error`s that are not one of our expected types to ensure we don't leak internal information to the API due to neglecting to wrap an error. However, I don't see an easy way to catch these errors aside from implementing our own unmarshaling functions.
### What did you expect?
I'm curious if it would make sense to return `gqlerror.Error`s in the `Unmarshal*` scalar methods so that an error presenter could identify that these errors are safe to pass back to the client.
Alternatively, perhaps they could return a new error type like `gqlerror.UnmarshalError`.
### versions
- gqlversion 0.9.0
- go version 1.12.6
コントリビューションガイド
評価
この issue はまだ評価されていません。