diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-14 12:40:31 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-14 12:41:59 +0200 |
commit | b478cd1bcb4756b20f7f4b15fcf81f23e1a60a02 (patch) | |
tree | 8ce232dcab3dd00708f8ba66c334472457e5980d /vendor/github.com/vektah/gqlgen/graphql/error.go | |
parent | a3fc9abb921f5ce7084d6ab7473442d0b72b1d78 (diff) | |
download | git-bug-b478cd1bcb4756b20f7f4b15fcf81f23e1a60a02.tar.gz |
graphql: update gqlgen to 0.5.1
fix #6
Diffstat (limited to 'vendor/github.com/vektah/gqlgen/graphql/error.go')
-rw-r--r-- | vendor/github.com/vektah/gqlgen/graphql/error.go | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/vendor/github.com/vektah/gqlgen/graphql/error.go b/vendor/github.com/vektah/gqlgen/graphql/error.go deleted file mode 100644 index 15e65fab..00000000 --- a/vendor/github.com/vektah/gqlgen/graphql/error.go +++ /dev/null @@ -1,46 +0,0 @@ -package graphql - -import ( - "context" -) - -// Error is the standard graphql error type described in https://facebook.github.io/graphql/draft/#sec-Errors -type Error struct { - Message string `json:"message"` - Path []interface{} `json:"path,omitempty"` - Locations []ErrorLocation `json:"locations,omitempty"` - Extensions map[string]interface{} `json:"extensions,omitempty"` -} - -func (e *Error) Error() string { - return e.Message -} - -type ErrorLocation struct { - Line int `json:"line,omitempty"` - Column int `json:"column,omitempty"` -} - -type ErrorPresenterFunc func(context.Context, error) *Error - -type ExtendedError interface { - Extensions() map[string]interface{} -} - -func DefaultErrorPresenter(ctx context.Context, err error) *Error { - if gqlerr, ok := err.(*Error); ok { - gqlerr.Path = GetResolverContext(ctx).Path - return gqlerr - } - - var extensions map[string]interface{} - if ee, ok := err.(ExtendedError); ok { - extensions = ee.Extensions() - } - - return &Error{ - Message: err.Error(), - Path: GetResolverContext(ctx).Path, - Extensions: extensions, - } -} |