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

Function buildErrorInitData

codegen/service/service_data.go:1246–1264  ·  view source on GitHub ↗

buildErrorInitData creates the data needed to generate code around endpoint error return values.

(er *expr.ErrorExpr, scope *codegen.NameScope)

Source from the content-addressed store, hash-verified

1244
1245// buildErrorInitData creates the data needed to generate code around endpoint error return values.
1246func buildErrorInitData(er *expr.ErrorExpr, scope *codegen.NameScope) *ErrorInitData {
1247 _, temporary := er.Meta["goa:error:temporary"]
1248 _, timeout := er.Meta["goa:error:timeout"]
1249 _, fault := er.Meta["goa:error:fault"]
1250 var pkg string
1251 if ut, ok := er.Type.(expr.UserType); ok {
1252 pkg = codegen.UserTypeLocation(ut).PackageName()
1253 }
1254 return &ErrorInitData{
1255 Name: fmt.Sprintf("Make%s", codegen.Goify(er.Name, true)),
1256 Description: er.Description,
1257 ErrName: er.Name,
1258 TypeName: scope.GoTypeName(er.AttributeExpr),
1259 TypeRef: scope.GoFullTypeRef(er.AttributeExpr, pkg),
1260 Temporary: temporary,
1261 Timeout: timeout,
1262 Fault: fault,
1263 }
1264}
1265
1266// buildMethodData creates the data needed to render the given endpoint. It
1267// records the user types needed by the service definition in userTypes.

Callers 2

analyzeMethod · 0.85
buildMethodDataMethod · 0.85

Calls 5

UserTypeLocationFunction · 0.92
GoifyFunction · 0.92
PackageNameMethod · 0.80
GoTypeNameMethod · 0.80
GoFullTypeRefMethod · 0.80

Tested by

no test coverage detected