github.com/sams1990/dockerrepo@v17.12.1-ce-rc2+incompatible/daemon/graphdriver/errors.go (about)

     1  package graphdriver
     2  
     3  const (
     4  	// ErrNotSupported returned when driver is not supported.
     5  	ErrNotSupported NotSupportedError = "driver not supported"
     6  	// ErrPrerequisites returned when driver does not meet prerequisites.
     7  	ErrPrerequisites NotSupportedError = "prerequisites for driver not satisfied (wrong filesystem?)"
     8  	// ErrIncompatibleFS returned when file system is not supported.
     9  	ErrIncompatibleFS NotSupportedError = "backing file system is unsupported for this graph driver"
    10  )
    11  
    12  // ErrUnSupported signals that the graph-driver is not supported on the current configuration
    13  type ErrUnSupported interface {
    14  	NotSupported()
    15  }
    16  
    17  // NotSupportedError signals that the graph-driver is not supported on the current configuration
    18  type NotSupportedError string
    19  
    20  func (e NotSupportedError) Error() string {
    21  	return string(e)
    22  }
    23  
    24  // NotSupported signals that a graph-driver is not supported.
    25  func (e NotSupportedError) NotSupported() {}
    26  
    27  // IsDriverNotSupported returns true if the error initializing
    28  // the graph driver is a non-supported error.
    29  func IsDriverNotSupported(err error) bool {
    30  	switch err.(type) {
    31  	case ErrUnSupported:
    32  		return true
    33  	default:
    34  		return false
    35  	}
    36  }