From 9a41b2b162971e8d473abc5f01b729b7d09fa8fd Mon Sep 17 00:00:00 2001 From: Frankie Gallina-Jones Date: Fri, 27 Aug 2021 13:56:39 -0400 Subject: [PATCH] expose dependency mapping error to caller gh-220 --- postal/service.go | 3 ++- postal/service_test.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/postal/service.go b/postal/service.go index 6d897b9a..37859a13 100644 --- a/postal/service.go +++ b/postal/service.go @@ -142,8 +142,9 @@ func (s Service) Resolve(path, id, version, stack string) (Dependency, error) { func (s Service) Deliver(dependency Dependency, cnbPath, layerPath, platformPath string) error { dependencyMappingURI, err := s.mappingResolver.FindDependencyMapping(dependency.SHA256, filepath.Join(platformPath, "bindings")) if err != nil { - return fmt.Errorf("failure checking out the bindings") + return fmt.Errorf("failure checking for dependency mappings: %s", err) } + if dependencyMappingURI != "" { dependency.URI = dependencyMappingURI } diff --git a/postal/service_test.go b/postal/service_test.go index fed2242f..f8f3a0c1 100644 --- a/postal/service_test.go +++ b/postal/service_test.go @@ -702,6 +702,16 @@ version = "this is super not semver" }) }) }) + context("when dependency mapping resolver fails", func() { + it.Before(func() { + mappingResolver.FindDependencyMappingCall.Returns.Error = fmt.Errorf("some dependency mapping error") + }) + it("fails to find dependency mappings", func() { + err := deliver() + + Expect(err).To(MatchError(ContainSubstring("some dependency mapping error"))) + }) + }) }) context("Install", func() {