From 641d414e31085b475814db4b83e5227ab7e5c77b Mon Sep 17 00:00:00 2001 From: Sam Coe Date: Wed, 17 Nov 2021 09:47:01 -0800 Subject: [PATCH] Separate errors with new line --- graphql.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/graphql.go b/graphql.go index ecfadfb..06ca511 100644 --- a/graphql.go +++ b/graphql.go @@ -123,8 +123,12 @@ type errors []struct { // Error implements error interface. func (e errors) Error() string { b := strings.Builder{} - for _, err := range e { + l := len(e) + for i, err := range e { b.WriteString(fmt.Sprintf("Message: %s, Locations: %+v", err.Message, err.Locations)) + if i != l-1 { + b.WriteString("\n") + } } return b.String() }