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/specgen/generate/config_linux.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/specgen/generate/config_linux.go')
-rw-r--r-- | pkg/specgen/generate/config_linux.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/pkg/specgen/generate/config_linux.go b/pkg/specgen/generate/config_linux.go index fac02ad01..fcb7641d2 100644 --- a/pkg/specgen/generate/config_linux.go +++ b/pkg/specgen/generate/config_linux.go @@ -52,7 +52,7 @@ func addPrivilegedDevices(g *generate.Generator) error { if err == unix.EPERM { continue } - return errors.Wrapf(err, "stat %s", d.Path) + return err } // Skip devices that the user has not access to. if st.Mode()&0007 == 0 { @@ -90,7 +90,7 @@ func DevicesFromPath(g *generate.Generator, devicePath string) error { } st, err := os.Stat(resolvedDevicePath) if err != nil { - return errors.Wrapf(err, "cannot stat device path %s", devicePath) + return err } if st.IsDir() { found := false @@ -231,10 +231,7 @@ func addDevice(g *generate.Generator, device string) error { } if rootless.IsRootless() { if _, err := os.Stat(src); err != nil { - if os.IsNotExist(err) { - return errors.Wrapf(err, "the specified device %s doesn't exist", src) - } - return errors.Wrapf(err, "stat device %s exist", src) + return err } perm := "ro" if strings.Contains(permissions, "w") { |