From bed500e2db974e544fcd0df49a1827fcd521b53f Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Tue, 27 Jun 2023 12:53:10 -0600 Subject: [PATCH] Added more gql logging --- gql_graph.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gql_graph.go b/gql_graph.go index 4cfadf7..e8c3a23 100644 --- a/gql_graph.go +++ b/gql_graph.go @@ -12,13 +12,19 @@ func GQLInterfaceGraphNode() *graphql.Interface { gql_interface_graph_node = graphql.NewInterface(graphql.InterfaceConfig{ Name: "GraphNode", ResolveType: func(p graphql.ResolveTypeParams) *graphql.Object { + ctx, ok := p.Context.Value("graph_context").(*GraphContext) + if ok == false { + return nil + } valid_nodes, ok := p.Context.Value("valid_nodes").(map[reflect.Type]*graphql.Object) if ok == false { + ctx.Log.Logf("gql", "Failed to get valid_nodes from Context") return nil } node_type, ok := p.Context.Value("node_type").(reflect.Type) if ok == false { + ctx.Log.Logf("gql", "Failed to get node_type from Context") return nil } @@ -65,13 +71,19 @@ func GQLInterfaceThread() *graphql.Interface { gql_interface_thread = graphql.NewInterface(graphql.InterfaceConfig{ Name: "Thread", ResolveType: func(p graphql.ResolveTypeParams) *graphql.Object { + ctx, ok := p.Context.Value("graph_context").(*GraphContext) + if ok == false { + return nil + } valid_threads, ok := p.Context.Value("valid_threads").(map[reflect.Type]*graphql.Object) if ok == false { + ctx.Log.Logf("gql", "Failed to get valid_threads from Context") return nil } thread_type, ok := p.Context.Value("thread_type").(reflect.Type) if ok == false { + ctx.Log.Logf("gql", "Failed to get thread_type from Context") return nil } @@ -88,6 +100,8 @@ func GQLInterfaceThread() *graphql.Interface { return GQLTypeBaseThread() } + ctx.Log.Logf("gql", "Found no type that matches %+v: %+v", p_type, p_type.Implements(thread_type)) + return nil }, Fields: graphql.Fields{}, @@ -127,13 +141,19 @@ func GQLInterfaceLockable() *graphql.Interface { gql_interface_lockable = graphql.NewInterface(graphql.InterfaceConfig{ Name: "Lockable", ResolveType: func(p graphql.ResolveTypeParams) *graphql.Object { + ctx, ok := p.Context.Value("graph_context").(*GraphContext) + if ok == false { + return nil + } valid_lockables, ok := p.Context.Value("valid_lockables").(map[reflect.Type]*graphql.Object) if ok == false { + ctx.Log.Logf("gql", "Failed to get valid_lockables from Context") return nil } lockable_type, ok := p.Context.Value("lockable_type").(reflect.Type) if ok == false { + ctx.Log.Logf("gql", "Failed to get lockable_type from Context") return nil }