Fix no internal error on node

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-12-19 17:57:12 +01:00
parent 393343e557
commit f72851df4d
4 changed files with 95 additions and 40 deletions

View File

@@ -15,8 +15,10 @@
package gqlutils
import (
"context"
"maps"
"github.com/99designs/gqlgen/graphql"
"github.com/vektah/gqlparser/v2/gqlerror"
)
@@ -77,3 +79,13 @@ func Invalid(err error, details map[string]any) *gqlerror.Error {
Extensions: extensions,
}
}
func InternalServerError(ctx context.Context) *gqlerror.Error {
return &gqlerror.Error{
Message: "An internal server error occurred. Please try again later.",
Path: graphql.GetPath(ctx),
Extensions: map[string]any{
"code": "INTERNAL_SERVER_ERROR",
},
}
}