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

Method Validate

expr/grpc_error.go:27–44  ·  view source on GitHub ↗

Validate makes sure there is a error expression that matches the gRPC error expression.

()

Source from the content-addressed store, hash-verified

25// Validate makes sure there is a error expression that matches the gRPC error
26// expression.
27func (e *GRPCErrorExpr) Validate() *eval.ValidationErrors {
28 verr := new(eval.ValidationErrors)
29 switch p := e.Response.Parent.(type) {
30 case *GRPCEndpointExpr:
31 if p.MethodExpr.Error(e.Name) == nil {
32 verr.Add(e, "Error %#v does not match an error defined in the method", e.Name)
33 }
34 case *GRPCServiceExpr:
35 if p.Error(e.Name) == nil {
36 verr.Add(e, "Error %#v does not match an error defined in the service", e.Name)
37 }
38 case *RootExpr:
39 if Root.Error(e.Name) == nil {
40 verr.Add(e, "Error %#v does not match an error defined in the API", e.Name)
41 }
42 }
43 return verr
44}
45
46// Finalize looks up the corresponding method error expression.
47func (e *GRPCErrorExpr) Finalize(a *GRPCEndpointExpr) {

Callers

nothing calls this directly

Calls 2

AddMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected