diff options
author | Michael Muré <batolettre@gmail.com> | 2022-08-23 15:02:41 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2022-08-23 15:09:31 +0200 |
commit | 8d11e620a3d663cf21a62910d0f3961a8aff4be1 (patch) | |
tree | 17dc3df82229eea5c3500e2bd8448060dc1ae849 /api/graphql/handler.go | |
parent | 5a70e8b3a2e0fe3d1a1dcd4c24bb6bf64633cb7f (diff) | |
download | git-bug-8d11e620a3d663cf21a62910d0f3961a8aff4be1.tar.gz |
webui: add a flag to log handling errors
Diffstat (limited to 'api/graphql/handler.go')
-rw-r--r-- | api/graphql/handler.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/api/graphql/handler.go b/api/graphql/handler.go index 00141f01..1d30bf72 100644 --- a/api/graphql/handler.go +++ b/api/graphql/handler.go @@ -20,11 +20,15 @@ type Handler struct { io.Closer } -func NewHandler(mrc *cache.MultiRepoCache) Handler { +func NewHandler(mrc *cache.MultiRepoCache, errorOut io.Writer) Handler { rootResolver := resolvers.NewRootResolver(mrc) config := graph.Config{Resolvers: rootResolver} h := handler.NewDefaultServer(graph.NewExecutableSchema(config)) + if errorOut != nil { + h.Use(&Tracer{Out: errorOut}) + } + return Handler{ Handler: h, Closer: rootResolver, |