errors.go 992 B

12345678910111213141516171819202122232425262728293031
  1. package cgroups
  2. import (
  3. "errors"
  4. "os"
  5. )
  6. var (
  7. ErrInvalidPid = errors.New("cgroups: pid must be greater than 0")
  8. ErrMountPointNotExist = errors.New("cgroups: cgroup mountpoint does not exist")
  9. ErrInvalidFormat = errors.New("cgroups: parsing file with invalid format failed")
  10. ErrFreezerNotSupported = errors.New("cgroups: freezer cgroup not supported on this system")
  11. ErrMemoryNotSupported = errors.New("cgroups: memory cgroup not supported on this system")
  12. ErrCgroupDeleted = errors.New("cgroups: cgroup deleted")
  13. ErrNoCgroupMountDestination = errors.New("cgroups: cannot found cgroup mount destination")
  14. )
  15. // ErrorHandler is a function that handles and acts on errors
  16. type ErrorHandler func(err error) error
  17. // IgnoreNotExist ignores any errors that are for not existing files
  18. func IgnoreNotExist(err error) error {
  19. if os.IsNotExist(err) {
  20. return nil
  21. }
  22. return err
  23. }
  24. func errPassthrough(err error) error {
  25. return err
  26. }