diff --git a/pkg/app/app.go b/pkg/app/app.go index 9a8a64a1..69de4bc4 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -943,7 +943,10 @@ func (a *App) ForEachState(do func(*Run) (bool, []error), includeTransitiveNeeds err := a.visitStatesWithSelectorsAndRemoteSupport(a.FileOrDir, func(st *state.HelmState) (bool, []error) { helm := a.getHelm(st) - run := NewRun(st, helm, ctx) + run, err := NewRun(st, helm, ctx) + if err != nil { + return false, []error{err} + } return do(run) }, includeTransitiveNeeds, o...) diff --git a/pkg/app/run.go b/pkg/app/run.go index 61ac86f6..c7ab9093 100644 --- a/pkg/app/run.go +++ b/pkg/app/run.go @@ -21,16 +21,16 @@ type Run struct { Ask func(string) bool } -func NewRun(st *state.HelmState, helm helmexec.Interface, ctx Context) *Run { +func NewRun(st *state.HelmState, helm helmexec.Interface, ctx Context) (*Run, error) { if helm == nil { - panic("Assertion failed: helmexec.Interface must not be nil") + return nil, fmt.Errorf("Assertion failed: helmexec.Interface must not be nil") } if !helm.IsHelm3() { - panic("helmfile has deprecated helm2 since v1.0") + return nil, fmt.Errorf("helmfile has deprecated helm2 since v0.150.0") } - return &Run{state: st, helm: helm, ctx: ctx} + return &Run{state: st, helm: helm, ctx: ctx}, nil } func (r *Run) askForConfirmation(msg string) bool {