github.com/ssdev-go/moby@v17.12.1-ce-rc2+incompatible/libcontainerd/errors.go (about)

     1  package libcontainerd
     2  
     3  import "errors"
     4  
     5  type liberr struct {
     6  	err error
     7  }
     8  
     9  func (e liberr) Error() string {
    10  	return e.err.Error()
    11  }
    12  
    13  func (e liberr) Cause() error {
    14  	return e.err
    15  }
    16  
    17  type notFoundErr struct {
    18  	liberr
    19  }
    20  
    21  func (notFoundErr) NotFound() {}
    22  
    23  func newNotFoundError(err string) error { return notFoundErr{liberr{errors.New(err)}} }
    24  func wrapNotFoundError(err error) error { return notFoundErr{liberr{err}} }
    25  
    26  type invalidParamErr struct {
    27  	liberr
    28  }
    29  
    30  func (invalidParamErr) InvalidParameter() {}
    31  
    32  func newInvalidParameterError(err string) error { return invalidParamErr{liberr{errors.New(err)}} }
    33  
    34  type conflictErr struct {
    35  	liberr
    36  }
    37  
    38  func (conflictErr) ConflictErr() {}
    39  
    40  func newConflictError(err string) error { return conflictErr{liberr{errors.New(err)}} }
    41  
    42  type sysErr struct {
    43  	liberr
    44  }
    45  
    46  func wrapSystemError(err error) error { return sysErr{liberr{err}} }