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

Function ReportError

eval/eval.go:99–115  ·  view source on GitHub ↗

ReportError records a DSL error for reporting post DSL execution. It accepts a format and values a la fmt.Printf.

(fm string, vals ...any)

Source from the content-addressed store, hash-verified

97// ReportError records a DSL error for reporting post DSL execution. It accepts
98// a format and values a la fmt.Printf.
99func ReportError(fm string, vals ...any) {
100 var suffix string
101 if cur := Context.Stack.Current(); cur != nil {
102 if name := cur.EvalName(); name != "" {
103 suffix = fmt.Sprintf(" in %s", name)
104 }
105 } else {
106 suffix = " (top level)"
107 }
108 err := fmt.Errorf(fm+suffix, vals...)
109 file, line := computeErrorLocation()
110 Context.Record(&Error{
111 GoError: err,
112 File: file,
113 Line: line,
114 })
115}
116
117// IncompatibleDSL should be called by DSL functions when they are invoked in an
118// incorrect context (e.g. "Params" in "Service").

Callers 15

reportErrorHereFunction · 0.92
MethodFunction · 0.92
APIFunction · 0.92
PathFunction · 0.92
routeFunction · 0.92
HeaderFunction · 0.92
CookieFunction · 0.92
ParamFunction · 0.92
BodyFunction · 0.92
TypeFunction · 0.92
ArrayOfFunction · 0.92

Calls 4

computeErrorLocationFunction · 0.85
CurrentMethod · 0.80
RecordMethod · 0.80
EvalNameMethod · 0.65

Tested by 2

reportErrorHereFunction · 0.74