Skip to content

Commit 81107ad

Browse files
author
Abhishek Srivastava
authored
Merge pull request #7 from tokopedia/418_standardization_wrap_goerror_inside_GraphQLError
Wrapping go native errors into type gqlerrs for handling 418 issue
2 parents a16f017 + 7ac34cb commit 81107ad

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

internal/exec/exec.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,20 @@ func execFieldSelection(ctx context.Context, r *Request, s *resolvable.Schema, f
216216
err := errors.Errorf("%s", resolverErr)
217217
err.Path = path.toSlice()
218218
err.ResolverError = resolverErr
219-
return err
219+
errs := errors.QueryError{
220+
Message: err.Message,
221+
Locations: err.Locations,
222+
Path: err.Path,
223+
Rule: "",
224+
ResolverError: err.ResolverError,
225+
Extensions: errors.Extensions{
226+
Code: 0,
227+
DeveloperMessage: err.Message,
228+
MoreInfo: fmt.Sprintf("%s", err.Path),
229+
Timestamp: "",
230+
},
231+
}
232+
return &errs
220233
}
221234
} else {
222235
// TODO extract out unwrapping ptr logic to a common place

0 commit comments

Comments
 (0)