1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Replace errors.Cause() with errors.Is() / errors.As()

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-04-17 12:01:01 +02:00
parent 45369c61a4
commit 07d60bc257
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
23 changed files with 50 additions and 45 deletions

View file

@ -42,18 +42,14 @@ func Unmount(target string) error {
var err error
for i := 0; i < retries; i++ {
err = mount.Unmount(target)
switch errors.Cause(err) {
case nil:
return nil
case unix.EBUSY:
if err != nil && errors.Is(err, unix.EBUSY) {
logger.Debugf("aufs unmount %s failed with EBUSY (retrying %d/%d)", target, i+1, retries)
time.Sleep(100 * time.Millisecond)
continue // try again
default:
// any other error is fatal
return err
}
break
}
// either no error occurred, or another error
return err
}