fix: propagate errors instead of panic in list()

When skipCharts=false, errors from list() now properly propagate instead
of causing a crash. Uses a closure variable to capture the error and
propagates it after withPreparedCharts completes.

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2026-03-16 14:14:11 +08:00
parent b2a01c84aa
commit 1d0ffc5615
1 changed files with 5 additions and 5 deletions

View File

@ -643,17 +643,17 @@ func (a *App) ListReleases(c ListConfigProvider) error {
var err error
if !c.SkipCharts() {
var listErr error
err = run.withPreparedCharts("list", state.ChartPrepareOptions{
SkipRepos: true,
SkipDeps: true,
Concurrency: 2,
}, func() {
rel, err := a.list(run)
if err != nil {
panic(err)
}
stateReleases = rel
stateReleases, listErr = a.list(run)
})
if listErr != nil {
err = listErr
}
} else {
stateReleases, err = a.list(run)
}