Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ type File struct {
}

type GraphQLError struct {
err error
Err error
Message string
Path []string
Extensions GraphQLErrorExtensions
Expand All @@ -339,26 +339,26 @@ func newGraphQLError(err error) error {
}

return &GraphQLError{
err: err,
Err: err,
}
}

func (gqlErr *GraphQLError) Error() string {
if gqlErr.err != nil {
return gqlErr.err.Error()
if gqlErr.Err != nil {
return gqlErr.Err.Error()
} else {
return gqlErr.Message
}
}

func IsClientError(err error) bool {
gqlErr, ok := err.(*GraphQLError)
return ok && gqlErr.err != nil && len(gqlErr.Extensions.Code) == 0
return ok && gqlErr.Err != nil && len(gqlErr.Extensions.Code) == 0
}

func IsGraphQLError(err error) bool {
gqlErr, ok := err.(*GraphQLError)
return ok && gqlErr.err == nil && len(gqlErr.Extensions.Code) > 0
return ok && gqlErr.Err == nil && len(gqlErr.Extensions.Code) > 0
}

func IsUnauthorizedError(err error) bool {
Expand Down