MCPcopy
hub / github.com/dgraph-io/dgraph / SetPathIfEmpty

Function SetPathIfEmpty

graphql/schema/errors.go:135–143  ·  view source on GitHub ↗

SetPathIfEmpty sets error's path with the given path item as the only item in path, only if initially the error had no path.

(err error, pathItem interface{})

Source from the content-addressed store, hash-verified

133// SetPathIfEmpty sets error's path with the given path item as the only item in path,
134// only if initially the error had no path.
135func SetPathIfEmpty(err error, pathItem interface{}) error {
136 gqlErrs := AsGQLErrors(err)
137 for _, e := range gqlErrs {
138 if len(e.Path) == 0 {
139 e.Path = []interface{}{pathItem}
140 }
141 }
142 return gqlErrs
143}
144
145// PrependPath adds the given path item as the first item in the error's path list.
146func PrependPath(err error, pathItem interface{}) error {

Callers 1

rewriteAndExecuteMethod · 0.92

Calls 1

AsGQLErrorsFunction · 0.85

Tested by

no test coverage detected