diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-10-28 13:16:42 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-10-30 05:34:04 -0400 |
commit | 831d7fb0d7ee007fc04b1b0ff24b77c7d5635f5e (patch) | |
tree | 2888d983aea9538c421bcb2cbfce818a1904dd7a /pkg/domain/infra/abi/play.go | |
parent | 228396a99dc88fc828f23d4072a46ca8de90282f (diff) | |
download | podman-831d7fb0d7ee007fc04b1b0ff24b77c7d5635f5e.tar.gz podman-831d7fb0d7ee007fc04b1b0ff24b77c7d5635f5e.tar.bz2 podman-831d7fb0d7ee007fc04b1b0ff24b77c7d5635f5e.zip |
Stop excessive wrapping of errors
Most of the builtin golang functions like os.Stat and
os.Open report errors including the file system object
path. We should not wrap these errors and put the file path
in a second time, causing stuttering of errors when they
get presented to the user.
This patch tries to cleanup a bunch of these errors.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/domain/infra/abi/play.go')
-rw-r--r-- | pkg/domain/infra/abi/play.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go index 348570a20..57de0f3b1 100644 --- a/pkg/domain/infra/abi/play.go +++ b/pkg/domain/infra/abi/play.go @@ -251,7 +251,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY case v1.HostPathDirectoryOrCreate: if _, err := os.Stat(hostPath.Path); os.IsNotExist(err) { if err := os.Mkdir(hostPath.Path, kubeDirectoryPermission); err != nil { - return nil, errors.Errorf("error creating HostPath %s", volume.Name) + return nil, err } } // Label a newly created volume @@ -262,7 +262,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY if _, err := os.Stat(hostPath.Path); os.IsNotExist(err) { f, err := os.OpenFile(hostPath.Path, os.O_RDONLY|os.O_CREATE, kubeFilePermission) if err != nil { - return nil, errors.Errorf("error creating HostPath %s", volume.Name) + return nil, errors.Wrap(err, "error creating HostPath") } if err := f.Close(); err != nil { logrus.Warnf("Error in closing newly created HostPath file: %v", err) |