Skip to content

Commit

Permalink
fix: Ensure that nil http responses don't cause issues (#3329)
Browse files Browse the repository at this point in the history
  • Loading branch information
df-wg authored Oct 14, 2024
1 parent 6ec416b commit 96429c1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions graphql/handler/debug/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ func (a Tracer) InterceptResponse(ctx context.Context, next graphql.ResponseHand
resp := next(ctx)

_, _ = fmt.Fprintln(a.out, " resp:", aurora.Green(stringify(resp)))
for _, err := range resp.Errors {
_, _ = fmt.Fprintln(a.out, " error:", aurora.Bold(err.Path.String()+":"), aurora.Red(err.Message))
if resp != nil {
for _, err := range resp.Errors {
_, _ = fmt.Fprintln(a.out, " error:", aurora.Bold(err.Path.String()+":"), aurora.Red(err.Message))
}
}

_, _ = fmt.Fprintln(a.out, "}")
_, _ = fmt.Fprintln(a.out)
return resp
Expand Down

0 comments on commit 96429c1

Please sign in to comment.