Skip to content

Commit 96bee65

Browse files
committed
marshal, print, and exit on generate error
1 parent 10513ae commit 96bee65

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/goformation/generate/generate.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,12 @@ func generatePolymorphicProperty(typename string, name string, property Property
484484
"convertToGoType": convertTypeToGo,
485485
"convertToPureGoType": convertTypeToPureGo,
486486
}).ParseFiles("generate/templates/polymorphic-property.template")
487-
487+
if err != nil {
488+
jsonProperty, _ := json.Marshal(property)
489+
fmt.Println("Error: Creating new template from property:")
490+
fmt.Printf("%s\n%s\n", jsonProperty, err)
491+
os.Exit(1)
492+
}
488493
nameParts := strings.Split(name, "_")
489494

490495
types := append([]string{}, property.PrimitiveTypes...)

0 commit comments

Comments
 (0)