Skip to content

Commit

Permalink
feat: use a more specific error type for no container info (#1115)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeremy L. Morris <[email protected]>
  • Loading branch information
MorrisLaw and Jeremy L. Morris authored Nov 12, 2021
1 parent ac00e48 commit d9d6f79
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func (c Container) VerifyConfiguration() error {

containerInfo := c.ContainerInfo()
if containerInfo == nil {
return errorInvalidConfig
return errorNoContainerInfo
}

containerConfig := containerInfo.Config
Expand Down
2 changes: 1 addition & 1 deletion pkg/container/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var _ = Describe("the container", func() {
c := mockContainerWithPortBindings()
c.containerInfo = nil
err := c.VerifyConfiguration()
Expect(err).To(Equal(errorInvalidConfig))
Expect(err).To(Equal(errorNoContainerInfo))
})
})
When("verifying a container with no config", func() {
Expand Down
1 change: 1 addition & 0 deletions pkg/container/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ package container
import "errors"

var errorNoImageInfo = errors.New("no available image info")
var errorNoContainerInfo = errors.New("no available container info")
var errorNoExposedPorts = errors.New("exposed ports does not match port bindings")
var errorInvalidConfig = errors.New("container configuration missing or invalid")

0 comments on commit d9d6f79

Please sign in to comment.