1 Star 0 Fork 0

麦冬果果 / graphql-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
located.go 786 Bytes
一键复制 编辑 原始数据 按行查看 历史
Hafiz Ismail 提交于 2016-04-17 14:32 . Fix further go lint ./... warnings
package gqlerrors
import (
"errors"
"github.com/graphql-go/graphql/language/ast"
)
// NewLocatedError creates a graphql.Error with location info
// @deprecated 0.4.18
// Already exists in `graphql.NewLocatedError()`
func NewLocatedError(err interface{}, nodes []ast.Node) *Error {
var origError error
message := "An unknown error occurred."
if err, ok := err.(error); ok {
message = err.Error()
origError = err
}
if err, ok := err.(string); ok {
message = err
origError = errors.New(err)
}
stack := message
return NewError(
message,
nodes,
stack,
nil,
[]int{},
origError,
)
}
func FieldASTsToNodeASTs(fieldASTs []*ast.Field) []ast.Node {
nodes := []ast.Node{}
for _, fieldAST := range fieldASTs {
nodes = append(nodes, fieldAST)
}
return nodes
}
1
https://gitee.com/mdgg0816/graphql-go.git
git@gitee.com:mdgg0816/graphql-go.git
mdgg0816
graphql-go
graphql-go
v0.7.6

搜索帮助