Skip to content

Commit

Permalink
expose dependency mapping error to caller
Browse files Browse the repository at this point in the history
  • Loading branch information
Frankie Gallina-Jones authored and ForestEckhardt committed Aug 30, 2021
1 parent 80303bf commit f0fe48c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion postal/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 10 additions & 0 deletions postal/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit f0fe48c

Please sign in to comment.