errors.go 1.2 KB

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