Skip to content

Commit

Permalink
wip: Keep the plan nil checks inside the inner functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzadlone committed May 31, 2022
1 parent 5229476 commit a2cb0fd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions query/graphql/planner/planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,10 @@ func (p *Planner) explainRequest(
plan planNode,
) ([]map[string]interface{}, error) {

if plan == nil {
return nil, fmt.Errorf("Can't explain request of a nil plan.")
}

explainGraph, err := buildExplainGraph(plan)
if err != nil {
return nil, err
Expand All @@ -449,6 +453,10 @@ func (p *Planner) executeRequest(
plan planNode,
) ([]map[string]interface{}, error) {

if plan == nil {
return nil, fmt.Errorf("Can't execute request of a nil plan.")
}

if err := plan.Start(); err != nil {
return nil, multiErr(err, plan.Close())
}
Expand Down Expand Up @@ -491,10 +499,6 @@ func (p *Planner) runRequest(
return nil, err
}

if plan == nil {
return nil, fmt.Errorf("Can't run request of an empty / nil plan.")
}

isAnExplainRequest :=
(len(query.Queries) > 0 && query.Queries[0].IsExplain) ||
(len(query.Mutations) > 0 && query.Mutations[0].IsExplain)
Expand Down

0 comments on commit a2cb0fd

Please sign in to comment.