MCPcopy Create free account
hub / github.com/goadesign/goa / AddError

Method AddError

eval/eval.go:177–186  ·  view source on GitHub ↗

AddError adds a validation error to the target. It "flattens" validation errors so that the recorded errors are never ValidationErrors themselves.

(def Expression, err error)

Source from the content-addressed store, hash-verified

175// AddError adds a validation error to the target. It "flattens" validation
176// errors so that the recorded errors are never ValidationErrors themselves.
177func (verr *ValidationErrors) AddError(def Expression, err error) {
178 var v *ValidationErrors
179 if errors.As(err, &v) {
180 verr.Errors = append(verr.Errors, v.Errors...)
181 verr.Expressions = append(verr.Expressions, v.Expressions...)
182 return
183 }
184 verr.Errors = append(verr.Errors, err)
185 verr.Expressions = append(verr.Expressions, def)
186}
187
188// runSet executes the DSL for all expressions in the given set. The expression
189// DSLs may append to the set as they execute.

Callers 6

TestValidationErrorsFunction · 0.95
AddMethod · 0.95
validateSetFunction · 0.95

Calls

no outgoing calls