MCPcopy Create free account
hub / github.com/cli/cli / checkErrors

Method checkErrors

script/ghmock/graphqlcheck.go:196–216  ·  view source on GitHub ↗
(v any)

Source from the content-addressed store, hash-verified

194}
195
196func (w *gqlWalker) checkErrors(v any) {
197 list, ok := v.([]any)
198 if !ok {
199 w.addf("errors", "should be a list, but is %s", describeJSON(v))
200 return
201 }
202 if len(list) == 0 {
203 w.addf("errors", "must contain at least one error")
204 }
205 for i, item := range list {
206 path := fmt.Sprintf("errors.%d", i)
207 obj, ok := item.(map[string]any)
208 if !ok {
209 w.addf(path, "should be an object, but is %s", describeJSON(item))
210 continue
211 }
212 if _, ok := obj["message"].(string); !ok {
213 w.addf(path+".message", "should be a string, but is %s", describeJSON(obj["message"]))
214 }
215 }
216}
217
218// selected is a field the query asked for. Fields in fragments or directives
219// that might not apply aren't required. Fields in

Callers 1

checkGraphQLResponseFunction · 0.95

Calls 2

addfMethod · 0.95
describeJSONFunction · 0.85

Tested by

no test coverage detected