gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

errors.go (1587B)


      1 /*
      2    Copyright The containerd Authors.
      3 
      4    Licensed under the Apache License, Version 2.0 (the "License");
      5    you may not use this file except in compliance with the License.
      6    You may obtain a copy of the License at
      7 
      8        http://www.apache.org/licenses/LICENSE-2.0
      9 
     10    Unless required by applicable law or agreed to in writing, software
     11    distributed under the License is distributed on an "AS IS" BASIS,
     12    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13    See the License for the specific language governing permissions and
     14    limitations under the License.
     15 */
     16 
     17 package cgroup1
     18 
     19 import (
     20 	"errors"
     21 	"os"
     22 )
     23 
     24 var (
     25 	ErrInvalidPid               = errors.New("cgroups: pid must be greater than 0")
     26 	ErrMountPointNotExist       = errors.New("cgroups: cgroup mountpoint does not exist")
     27 	ErrInvalidFormat            = errors.New("cgroups: parsing file with invalid format failed")
     28 	ErrFreezerNotSupported      = errors.New("cgroups: freezer cgroup not supported on this system")
     29 	ErrMemoryNotSupported       = errors.New("cgroups: memory cgroup not supported on this system")
     30 	ErrCgroupDeleted            = errors.New("cgroups: cgroup deleted")
     31 	ErrNoCgroupMountDestination = errors.New("cgroups: cannot find cgroup mount destination")
     32 )
     33 
     34 // ErrorHandler is a function that handles and acts on errors
     35 type ErrorHandler func(err error) error
     36 
     37 // IgnoreNotExist ignores any errors that are for not existing files
     38 func IgnoreNotExist(err error) error {
     39 	if os.IsNotExist(err) {
     40 		return nil
     41 	}
     42 	return err
     43 }
     44 
     45 func errPassthrough(err error) error {
     46 	return err
     47 }