aboutsummaryrefslogtreecommitdiffstats
path: root/api/graphql/handler.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-08-23 15:02:41 +0200
committerMichael Muré <batolettre@gmail.com>2022-08-23 15:09:31 +0200
commit8d11e620a3d663cf21a62910d0f3961a8aff4be1 (patch)
tree17dc3df82229eea5c3500e2bd8448060dc1ae849 /api/graphql/handler.go
parent5a70e8b3a2e0fe3d1a1dcd4c24bb6bf64633cb7f (diff)
downloadgit-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.go6
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,