Skip to content

Commit 6a25cc3

Browse files
author
Eric Rutherford
committed
removing the constant and opting for duplicating the string
1 parent 9835de6 commit 6a25cc3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

graphql.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ import (
4242
"github.com/pkg/errors"
4343
)
4444

45-
const errorNon200Template = "graphql: server returned a non-200 status code: %v"
46-
4745
// Client is a client for interacting with a GraphQL API.
4846
type Client struct {
4947
endpoint string
@@ -137,7 +135,7 @@ func (c *Client) runWithJSON(ctx context.Context, req *Request, resp interface{}
137135
c.logf("<< %s", buf.String())
138136
if err := json.NewDecoder(&buf).Decode(&gr); err != nil {
139137
if res.StatusCode != http.StatusOK {
140-
return fmt.Errorf(errorNon200Template, res.StatusCode)
138+
return fmt.Errorf("graphql: server returned a non-200 status code: %v", res.StatusCode)
141139
}
142140
return errors.Wrap(err, "decoding response")
143141
}
@@ -207,7 +205,7 @@ func (c *Client) runWithPostFields(ctx context.Context, req *Request, resp inter
207205
c.logf("<< %s", buf.String())
208206
if err := json.NewDecoder(&buf).Decode(&gr); err != nil {
209207
if res.StatusCode != http.StatusOK {
210-
return fmt.Errorf(errorNon200Template, res.StatusCode)
208+
return fmt.Errorf("graphql: server returned a non-200 status code: %v", res.StatusCode)
211209
}
212210
return errors.Wrap(err, "decoding response")
213211
}

0 commit comments

Comments
 (0)