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:
		
							parent
							
								
									45369c61a4
								
							
						
					
					
						commit
						07d60bc257
					
				
					 23 changed files with 50 additions and 45 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue