Add Help text to yaml parsing error
@@ -73,10 +73,7 @@ func unmarshalObject(source string, bytes []byte) (resource.Resource, error) {
}
r, err := unmarshalKind(base, bytes)
if err != nil {
- return nil, &fluxerr.Error{
- Type: fluxerr.User,
- Err: err,
- }
+ return nil, makeUnmarshalObjectErr(source, err)
}
return r, nil
}
@@ -127,5 +124,16 @@ func unmarshalKind(base baseObject, bytes []byte) (resource.Resource, error) {
}
}
+func makeUnmarshalObjectErr(source string, err error) *fluxerr.Error {
+ return &fluxerr.Error{
+ Type: fluxerr.User,
+ Err: err,
+ Help: `Could not parse "` + source + `".
+
+This likely means it is malformed YAML.
+`,
+ }
+}
+
// For reference, the Kubernetes v1 types are in:
// https://github.com/kubernetes/client-go/blob/master/pkg/api/v1/types.go
