Skip to content

Commit

Permalink
Add ResolverError field to QueryError for post processing
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Randall authored and neelance committed Jan 11, 2017
1 parent b7c59ab commit eccedde
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package errors
import "fmt"

type QueryError struct {
Message string `json:"message"`
Locations []*Location `json:"locations,omitempty"`
Message string `json:"message"`
Locations []*Location `json:"locations,omitempty"`
ResolverError error `json:"-"`
}

type Location struct {
Expand Down
4 changes: 3 additions & 1 deletion internal/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,9 @@ func (e *fieldExec) execField(ctx context.Context, r *request, f *query.Field, r
result, err := e.execField2(spanCtx, r, f, resolver, span)

if err != nil {
r.addError(errors.Errorf("%s", err))
queryError := errors.Errorf("%s", err)
queryError.ResolverError = err
r.addError(queryError)
addResult(f.Alias, nil) // TODO handle non-nil

ext.Error.Set(span, true)
Expand Down

0 comments on commit eccedde

Please sign in to comment.