diff --git a/pkg/kubectl/cmd/testdata/edit/testcase-apply-edit-last-applied-syntax-error/2.original b/pkg/kubectl/cmd/testdata/edit/testcase-apply-edit-last-applied-syntax-error/2.original index d17734396ff..601ea3bda65 100755 --- a/pkg/kubectl/cmd/testdata/edit/testcase-apply-edit-last-applied-syntax-error/2.original +++ b/pkg/kubectl/cmd/testdata/edit/testcase-apply-edit-last-applied-syntax-error/2.original @@ -1,7 +1,7 @@ # Please edit the 'last-applied-configuration' annotations below. # Lines beginning with a '#' will be ignored, and an empty file will abort the edit. # -# The edited file had a syntax error: error converting YAML to JSON: yaml: line 12: could not find expected ':' +# The edited file had a syntax error: error parsing edited-file: error converting YAML to JSON: yaml: line 12: could not find expected ':' # kind: Service metadata: diff --git a/pkg/kubectl/cmd/testdata/edit/testcase-syntax-error/2.original b/pkg/kubectl/cmd/testdata/edit/testcase-syntax-error/2.original index 85da34d2382..a229c98f05f 100755 --- a/pkg/kubectl/cmd/testdata/edit/testcase-syntax-error/2.original +++ b/pkg/kubectl/cmd/testdata/edit/testcase-syntax-error/2.original @@ -2,7 +2,7 @@ # and an empty file will abort the edit. If an error occurs while saving this file will be # reopened with the relevant failures. # -# The edited file had a syntax error: error converting YAML to JSON: yaml: line 17: could not find expected ':' +# The edited file had a syntax error: error parsing edited-file: error converting YAML to JSON: yaml: line 17: could not find expected ':' # apiVersion: v1 kind: Service diff --git a/pkg/kubectl/resource/visitor.go b/pkg/kubectl/resource/visitor.go index 554fa4a6611..7ab502239f0 100644 --- a/pkg/kubectl/resource/visitor.go +++ b/pkg/kubectl/resource/visitor.go @@ -578,7 +578,7 @@ func (v *StreamVisitor) Visit(fn VisitorFunc) error { if err == io.EOF { return nil } - return err + return fmt.Errorf("error parsing %s: %v", v.Source, err) } // TODO: This needs to be able to handle object in other encodings and schemas. ext.Raw = bytes.TrimSpace(ext.Raw)