package graphql

import "context"

type gqlExecutionErrorsContextKey struct{}

type gqlExecutionErrorCollector struct {
	errors []any
}

func addGQLExecutionError(ctx context.Context, message string, path []any) {
	collector, _ := ctx.Value(gqlExecutionErrorsContextKey{}).(*gqlExecutionErrorCollector)
	if collector == nil {
		return
	}
	collector.errors = append(collector.errors, map[string]any{
		"type": "INTERNAL", "path": path, "message": message,
	})
}
