Every error passed to error presenter was wrapped make it hard to handle unexpected error
- Lenguaje dominante
- Go
- Estrellas
- 10.8k
- Forks
- 1.3k
- Merge medio
- 2 d 36 min
- PR fusionados (30 d)
- 26
Descripción
### What happened?
Currently, we have an `ErrorPresenter` to intercept the error response. But every error from the operation is wrapped with `ErrorOnPath`. This makes it hard to handle unknown errors and response raw error messages to the users.
https://github.com/99designs/gqlgen/blob/76d444c15fc1d98538648a229f41ed7b4573bad7/graphql/context_response.go#L52-L61
Another thing is if we want to strip some error out from the response by returning `nil` value from `ErrorPresenter` will cause the app to panic for now. I suggest checking for `nil` value before appending the error to `c.errors`.
And by default when we create a new handler `DefaultErrorPresenter` was set and it has the ability to wrap the error path then I think we don't need to call `ErrorOnPath` before passing an error to `ErrorPresenter`.
### versions
- `gqlgen` v0.17.35
- `go` v1.20.6
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.