Skip to content

Commit 2fed553

Browse files
author
Mikalai Radchuk
committed
Improve error message about missing bundles
Signed-off-by: Mikalai Radchuk <[email protected]>
1 parent aca6451 commit 2fed553

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

internal/resolution/variablesources/bundle.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package variablesources
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"sort"
78

@@ -94,7 +95,7 @@ func MakeBundleVariables(
9495
// get bundle dependencies
9596
dependencies, err := filterBundleDependencies(allBundles, head)
9697
if err != nil {
97-
return nil, fmt.Errorf("could not determine dependencies for bundle with id %q: %w", id, err)
98+
return nil, fmt.Errorf("could not determine dependencies for bundle %q from package %q in catalog %q: %s", head.Name, head.Package, head.CatalogName, err)
9899
}
99100

100101
// add bundle dependencies to queue for processing
@@ -119,7 +120,7 @@ func filterBundleDependencies(allBundles []*catalogmetadata.Bundle, bundle *cata
119120
catalogfilter.InBlangSemverRange(requiredPackage.SemverRange),
120121
))
121122
if len(packageDependencyBundles) == 0 {
122-
return nil, fmt.Errorf("could not find package dependencies for bundle %q", bundle.Name)
123+
return nil, errors.New("could not find package dependencies for bundle")
123124
}
124125
for i := 0; i < len(packageDependencyBundles); i++ {
125126
bundle := packageDependencyBundles[i]

internal/resolution/variablesources/bundle_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func TestMakeBundleVariables_NonExistentDepedencies(t *testing.T) {
194194
installedPackages := []*olmvariables.InstalledPackageVariable{}
195195

196196
bundles, err := variablesources.MakeBundleVariables(allBundles, requiredPackages, installedPackages)
197-
assert.ErrorContains(t, err, `could not determine dependencies for bundle with id "fake-catalog-test-package-test-package.v1.0.0"`)
197+
assert.ErrorContains(t, err, `could not determine dependencies for bundle "test-package.v1.0.0" from package "test-package" in catalog "fake-catalog"`)
198198
assert.Nil(t, bundles)
199199
}
200200

@@ -550,7 +550,7 @@ var _ = Describe("BundlesAndDepsVariableSource", func() {
550550
)
551551
_, err := bdvs.GetVariables(context.TODO())
552552
Expect(err).To(HaveOccurred())
553-
Expect(err.Error()).To(ContainSubstring(`could not determine dependencies for bundle with id "fake-catalog-test-package-bundle-2": could not find package dependencies for bundle "bundle-2"`))
553+
Expect(err.Error()).To(ContainSubstring(`could not determine dependencies for bundle "bundle-2" from package "test-package" in catalog "fake-catalog": could not find package dependencies for bundle`))
554554
})
555555

556556
It("should return error if an inner variable source returns an error", func() {

0 commit comments

Comments
 (0)