errdefs

package
v1.7.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2024 License: Apache-2.0 Imports: 6 Imported by: 6,382

Documentation

Overview

Package errdefs defines the common errors used throughout containerd packages.

Use with fmt.Errorf 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.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknown            = errdefs.ErrUnknown
	ErrInvalidArgument    = errdefs.ErrInvalidArgument
	ErrNotFound           = errdefs.ErrNotFound
	ErrAlreadyExists      = errdefs.ErrAlreadyExists
	ErrPermissionDenied   = errdefs.ErrPermissionDenied
	ErrResourceExhausted  = errdefs.ErrResourceExhausted
	ErrFailedPrecondition = errdefs.ErrFailedPrecondition
	ErrConflict           = errdefs.ErrConflict
	ErrNotModified        = errdefs.ErrNotModified
	ErrAborted            = errdefs.ErrAborted
	ErrOutOfRange         = errdefs.ErrOutOfRange
	ErrNotImplemented     = errdefs.ErrNotImplemented
	ErrInternal           = errdefs.ErrInternal
	ErrUnavailable        = errdefs.ErrUnavailable
	ErrDataLoss           = errdefs.ErrDataLoss
	ErrUnauthenticated    = errdefs.ErrUnauthenticated

	IsCanceled           = errdefs.IsCanceled
	IsUnknown            = errdefs.IsUnknown
	IsInvalidArgument    = errdefs.IsInvalidArgument
	IsDeadlineExceeded   = errdefs.IsDeadlineExceeded
	IsNotFound           = errdefs.IsNotFound
	IsAlreadyExists      = errdefs.IsAlreadyExists
	IsPermissionDenied   = errdefs.IsPermissionDenied
	IsResourceExhausted  = errdefs.IsResourceExhausted
	IsFailedPrecondition = errdefs.IsFailedPrecondition
	IsConflict           = errdefs.IsConflict
	IsNotModified        = errdefs.IsNotModified
	IsAborted            = errdefs.IsAborted
	IsOutOfRange         = errdefs.IsOutOfRange
	IsNotImplemented     = errdefs.IsNotImplemented
	IsInternal           = errdefs.IsInternal
	IsUnavailable        = errdefs.IsUnavailable
	IsDataLoss           = errdefs.IsDataLoss
	IsUnauthorized       = errdefs.IsUnauthorized
)

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.

These errors map closely to grpc errors.

Functions

func FromGRPC

func FromGRPC(err error) error

FromGRPC returns the underlying error from a grpc service based on the grpc error code

func ToGRPC

func ToGRPC(err error) error

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.

func ToGRPCf

func ToGRPCf(err error, format string, args ...interface{}) error

ToGRPCf maps the error to grpc error codes, assembling the formatting string and combining it with the target error string.

This is equivalent to errdefs.ToGRPC(fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), err))

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL