Use httplogger on graphlq error

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-06-23 09:33:55 -07:00
parent 92c1a1da4f
commit 07d943be86
3 changed files with 5 additions and 1 deletions

2
go.mod
View File

@@ -19,7 +19,7 @@ require (
github.com/prometheus/client_golang v1.22.0
github.com/vektah/gqlparser/v2 v2.5.27
go.gearno.de/crypto/uuid v0.1.0
go.gearno.de/kit v0.0.0-20250517034137-7943a87a6d2f
go.gearno.de/kit v0.0.0-20250623163305-45b4f6905899
go.gearno.de/x/ref v0.0.0-20240502200927-d74926fcb14c
go.opentelemetry.io/otel v1.35.0
go.opentelemetry.io/otel/trace v1.35.0

2
go.sum
View File

@@ -160,6 +160,8 @@ go.gearno.de/crypto/uuid v0.1.0 h1:94BYg7GYItJ6yYZ1GJayb3VYhI9/FjxuR1nFaduR4hE=
go.gearno.de/crypto/uuid v0.1.0/go.mod h1:fnIIvKO9QnsyLO3ZJLJT3r8KZv/p0FOeT5eZKilYWXg=
go.gearno.de/kit v0.0.0-20250517034137-7943a87a6d2f h1:uo0q0g7Sdaj7UKFvB2mySeHgq646upIL7NYqOI1sD3U=
go.gearno.de/kit v0.0.0-20250517034137-7943a87a6d2f/go.mod h1:cEDPOR+WVloqrYmGBoSpHlLqSmTCBjW1j02ntm0Yk9U=
go.gearno.de/kit v0.0.0-20250623163305-45b4f6905899 h1:g44W/Fhm5bW7fhMqr874dJKOuHHsRhv6Tr3h6yHLcqY=
go.gearno.de/kit v0.0.0-20250623163305-45b4f6905899/go.mod h1:cEDPOR+WVloqrYmGBoSpHlLqSmTCBjW1j02ntm0Yk9U=
go.gearno.de/x/panicf v0.1.1 h1:E3Cr9NB8Ry2EsvEG/1eHr7kplP3tEjTf5d56dTX64VQ=
go.gearno.de/x/panicf v0.1.1/go.mod h1:VnB8oF0UefMZcYeD4v+Wk4U5Z1uza7PHLlhT2CbNEbU=
go.gearno.de/x/ref v0.0.0-20240502200927-d74926fcb14c h1:b8Wwr2owaB6g38tptSk5tekXFSE7RpXsUpaoCO8tQDM=

View File

@@ -41,6 +41,7 @@ import (
"github.com/getprobo/probo/pkg/usrmgr"
"github.com/go-chi/chi/v5"
"github.com/vektah/gqlparser/v2/gqlerror"
"go.gearno.de/kit/httpserver"
"go.gearno.de/kit/log"
)
@@ -232,6 +233,7 @@ func graphqlHandler(logger *log.Logger, proboSvc *probo.Service, usrmgrSvc *usrm
srv.Use(extension.Introspection{})
srv.Use(tracingExtension{})
srv.SetRecoverFunc(func(ctx context.Context, err any) error {
logger := httpserver.LoggerFromContext(ctx)
logger.Error("resolver panic", log.Any("error", err))
return errors.New("internal server error")