diff --git a/pkg/chart/repo/repo.go b/pkg/chart/repo/repo.go index cbffdc2f5..ad87d9828 100644 --- a/pkg/chart/repo/repo.go +++ b/pkg/chart/repo/repo.go @@ -120,7 +120,7 @@ func (r *Repo) ResolveVersion(chartspec *shipper.Chart) (*repo.ChartVersion, err } if len(versions) == 0 { - return nil, repo.ErrNoChartVersion + return nil, shippererrors.NewChartVersionResolveError(chartspec, repo.ErrNoChartVersion) } return versions[0], nil @@ -132,10 +132,10 @@ func (r *Repo) FetchChartVersions(chartspec *shipper.Chart) (repo.ChartVersions, vs, ok := r.index.Load().(*repo.IndexFile).Entries[chartspec.Name] if !ok { - return nil, repo.ErrNoChartName + return nil, shippererrors.NewChartVersionResolveError(chartspec, repo.ErrNoChartName) } if len(vs) == 0 { - return nil, repo.ErrNoChartVersion + return nil, shippererrors.NewChartVersionResolveError(chartspec, repo.ErrNoChartVersion) } var constraint *semver.Constraints @@ -254,7 +254,7 @@ func (r *Repo) Fetch(chartspec *shipper.Chart) (*chart.Chart, error) { } } if chartver == nil { - return nil, repo.ErrNoChartVersion + return nil, shippererrors.NewChartVersionResolveError(chartspec, repo.ErrNoChartVersion) } if chart, err := r.LoadCached(chartver); err == nil { diff --git a/pkg/chart/repo/repo_test.go b/pkg/chart/repo/repo_test.go index caff32766..60204f913 100644 --- a/pkg/chart/repo/repo_test.go +++ b/pkg/chart/repo/repo_test.go @@ -1,7 +1,6 @@ package repo import ( - "errors" "fmt" "io/ioutil" "net/url" @@ -216,7 +215,7 @@ func TestResolveVersion(t *testing.T) { "simple", "=1.0.0", "", - errors.New("no chart version found"), + fmt.Errorf("failed to resolve chart version [name: \"simple\", version: \"=1.0.0\", repo: \"https://charts.example.com\"]: no chart version found"), }, { "Existing dual version exact match", @@ -322,7 +321,7 @@ func TestFetch(t *testing.T) { "0.0.1", "", "", - fmt.Errorf("no chart name found"), + fmt.Errorf("failed to resolve chart version [name: \"unknown\", version: \"0.0.1\", repo: \"https://chart.example.com\"]: no chart name found"), }, { "Non-existing chart", @@ -330,7 +329,7 @@ func TestFetch(t *testing.T) { "10.20.30", "nginx", "", - fmt.Errorf("no chart version found"), + fmt.Errorf("failed to resolve chart version [name: \"nginx\", version: \"10.20.30\", repo: \"https://chart.example.com\"]: no chart version found"), }, { "Fails to fetch but exists in the cache",