mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
volume/local: localVolume.mount() move errors.Wrap()
While the current code is correct (as errors.Wrap() returns nil if err is nil), relying on this behavior has caused some confusion in the past, resulting in regressions. This patch makes the error-handling code slightly more idiomatic and defensive against such regressions. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
c1671abf14
commit
eecf7a0840
1 changed files with 3 additions and 3 deletions
|
@ -123,13 +123,13 @@ func (v *localVolume) mount() error {
|
|||
mountOpts = strings.Replace(mountOpts, "addr="+addrValue, "addr="+ipAddr.String(), 1)
|
||||
}
|
||||
}
|
||||
err := mount.Mount(v.opts.MountDevice, v.path, v.opts.MountType, mountOpts)
|
||||
if err != nil {
|
||||
if err := mount.Mount(v.opts.MountDevice, v.path, v.opts.MountType, mountOpts); err != nil {
|
||||
if password := getPassword(v.opts.MountOpts); password != "" {
|
||||
err = errors.New(strings.Replace(err.Error(), "password="+password, "password=********", 1))
|
||||
}
|
||||
return errors.Wrap(err, "failed to mount local volume")
|
||||
}
|
||||
return errors.Wrap(err, "failed to mount local volume")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *localVolume) postMount() error {
|
||||
|
|
Loading…
Add table
Reference in a new issue