Documentation ¶
Overview ¶
Package errdefs defines the common errors used throughout containerd packages.
Use with errors.Wrap and error.Wrapf to add context to an error.
To detect an error class, use the IsXXX functions to tell whether an error is of a certain type.
The functions ToGRPC and FromGRPC can be used to map server-side and client-side errors to the correct types.
Index ¶
- Variables
- func FromGRPC(err error) error
- func IsAlreadyExists(err error) bool
- func IsFailedPrecondition(err error) bool
- func IsInvalidArgument(err error) bool
- func IsNotFound(err error) bool
- func IsNotImplemented(err error) bool
- func IsUnavailable(err error) bool
- func ToGRPC(err error) error
- func ToGRPCf(err error, format string, args ...interface{}) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnknown = errors.New("unknown") // used internally to represent a missed mapping. ErrInvalidArgument = errors.New("invalid argument") ErrNotFound = errors.New("not found") ErrAlreadyExists = errors.New("already exists") ErrFailedPrecondition = errors.New("failed precondition") ErrNotImplemented = errors.New("not implemented") // represents not supported and unimplemented )
Definitions of common error types used throughout containerd. All containerd errors returned by most packages will map into one of these errors classes. Packages should return errors of these types when they want to instruct a client to take a particular action.
For the most part, we just try to provide local grpc errors. Most conditions map very well to those defined by grpc.
Functions ¶
func FromGRPC ¶
FromGRPC returns the underlying error from a grpc service based on the grpc error code
func IsAlreadyExists ¶
IsAlreadyExists returns true if the error is due to an already existing metadata item
func IsFailedPrecondition ¶
IsFailedPrecondition returns true if an operation could not proceed to the lack of a particular condition
func IsInvalidArgument ¶
IsInvalidArgument returns true if the error is due to an invalid argument
func IsNotFound ¶
IsNotFound returns true if the error is due to a missing object
func IsNotImplemented ¶
IsNotImplemented returns true if the error is due to not being implemented
func IsUnavailable ¶
IsUnavailable returns true if the error is due to a resource being unavailable
func ToGRPC ¶
ToGRPC will attempt to map the backend containerd error into a grpc error, using the original error message as a description.
Further information may be extracted from certain errors depending on their type.
If the error is unmapped, the original error will be returned to be handled by the regular grpc error handling stack.
Types ¶
This section is empty.