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

Function validationErrorLocation

eval/error.go:134–144  ·  view source on GitHub ↗

validationErrorLocation returns the location of the DSL that declared the given expression when available. The location is derived from the expression DSL function pointer and is used to annotate validation errors (i.e. errors returned by Validate()).

(expr Expression)

Source from the content-addressed store, hash-verified

132// The location is derived from the expression DSL function pointer and is used
133// to annotate validation errors (i.e. errors returned by Validate()).
134func validationErrorLocation(expr Expression) (file string, line int, ok bool) {
135 source, ok := expr.(Source)
136 if !ok {
137 return "", 0, false
138 }
139 fn := source.DSL()
140 if fn == nil {
141 return "", 0, false
142 }
143 return dslFuncLocation(fn)
144}
145
146// dslFuncLocation returns the file and line where the given DSL function is
147// declared.

Callers 1

ErrorMethod · 0.85

Calls 2

dslFuncLocationFunction · 0.85
DSLMethod · 0.65

Tested by

no test coverage detected