Closed schafle closed 2 years ago
https://github.com/vektah/gqlparser/issues/99
gqlparser functions are returning nil but the return type is *gqlrrror.Error.
nil
*gqlrrror.Error.
This is how the code looks like before my change: https://github.com/vektah/gqlparser/blob/master/parser/schema.go#L9
func ParseSchema(source *Source) (*SchemaDocument, *gqlerror.Error) { . . . return ast, nil }
The problem is while using this code, err != nil doesn't work since err is actually not nil it is zero value *gqlerror.Error.
err != nil
err
*gqlerror.Error
The issue had been raised in the past: https://github.com/vektah/gqlparser/issues/99 and they also had a PR for fix https://github.com/vektah/gqlparser/pull/100 which then was closed by author themself.
Coverage decreased (-0.02%) to 88.562% when pulling f8402753bf0746cdd7d539ab460d1a658ae733b4 on schafle:gqlerr_to_error into 6d97050e566d7f4597992609765ad5bec79cf001 on vektah:master.
Related Issue:
https://github.com/vektah/gqlparser/issues/99
Background
gqlparser functions are returning
nil
but the return type is*gqlrrror.Error.
This is how the code looks like before my change: https://github.com/vektah/gqlparser/blob/master/parser/schema.go#L9
The problem is while using this code,
err != nil
doesn't work sinceerr
is actually not nil it is zero value*gqlerror.Error
.The issue had been raised in the past: https://github.com/vektah/gqlparser/issues/99 and they also had a PR for fix https://github.com/vektah/gqlparser/pull/100 which then was closed by author themself.