diff options
author | Michael Muré <batolettre@gmail.com> | 2018-07-29 18:58:42 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-07-29 18:58:42 +0200 |
commit | 8fa0b258ac89781dae269790a4bde09cbcd2f324 (patch) | |
tree | b9bcf0826f5739f128de52123447cede23291c02 /vendor/github.com/graphql-go/graphql/gqlerrors/formatted.go | |
parent | 6363518c85cbd8247a5f6507b8a1dd3903cfb71d (diff) | |
download | git-bug-8fa0b258ac89781dae269790a4bde09cbcd2f324.tar.gz |
cleaning
Diffstat (limited to 'vendor/github.com/graphql-go/graphql/gqlerrors/formatted.go')
-rw-r--r-- | vendor/github.com/graphql-go/graphql/gqlerrors/formatted.go | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/vendor/github.com/graphql-go/graphql/gqlerrors/formatted.go b/vendor/github.com/graphql-go/graphql/gqlerrors/formatted.go deleted file mode 100644 index 3a1f8853..00000000 --- a/vendor/github.com/graphql-go/graphql/gqlerrors/formatted.go +++ /dev/null @@ -1,51 +0,0 @@ -package gqlerrors - -import ( - "errors" - - "github.com/graphql-go/graphql/language/location" -) - -type FormattedError struct { - Message string `json:"message"` - Locations []location.SourceLocation `json:"locations"` -} - -func (g FormattedError) Error() string { - return g.Message -} - -func NewFormattedError(message string) FormattedError { - err := errors.New(message) - return FormatError(err) -} - -func FormatError(err error) FormattedError { - switch err := err.(type) { - case FormattedError: - return err - case *Error: - return FormattedError{ - Message: err.Error(), - Locations: err.Locations, - } - case Error: - return FormattedError{ - Message: err.Error(), - Locations: err.Locations, - } - default: - return FormattedError{ - Message: err.Error(), - Locations: []location.SourceLocation{}, - } - } -} - -func FormatErrors(errs ...error) []FormattedError { - formattedErrors := []FormattedError{} - for _, err := range errs { - formattedErrors = append(formattedErrors, FormatError(err)) - } - return formattedErrors -} |