mirror of
https://github.com/helm/helm.git
synced 2026-06-30 19:57:48 +00:00
chore: store err separately for clarity
Signed-off-by: Jeaeun Kim <me@kyoku.dev>
This commit is contained in:
@@ -113,6 +113,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
||||
}
|
||||
return err
|
||||
}
|
||||
savedErr := err
|
||||
|
||||
// We ignore a potential error here because, when the --debug flag was specified,
|
||||
// we always want to print the YAML, even if it is not valid. The error is still returned afterwards.
|
||||
@@ -186,9 +187,9 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
||||
missing = false
|
||||
}
|
||||
if missing {
|
||||
if err != nil && settings.Debug {
|
||||
if savedErr != nil && settings.Debug {
|
||||
// assume the manifest itself is too malformed to be rendered
|
||||
return err
|
||||
return savedErr
|
||||
} else {
|
||||
return fmt.Errorf("could not find template %s in chart", f)
|
||||
}
|
||||
@@ -202,7 +203,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
return savedErr
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user