buildErrorInitData creates the data needed to generate code around endpoint error return values.
(er *expr.ErrorExpr, scope *codegen.NameScope)
| 1244 | |
| 1245 | // buildErrorInitData creates the data needed to generate code around endpoint error return values. |
| 1246 | func 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. |
no test coverage detected