errdefs

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 2 Imported by: 1,651

README

errdefs

A Go package for defining and checking common containerd errors.

Project details

errdefs is a containerd sub-project, licensed under the Apache 2.0 license. As a containerd sub-project, you will find the:

information in our containerd/project repository.

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            = errUnknown{}
	ErrInvalidArgument    = errInvalidArgument{}
	ErrNotFound           = errNotFound{}
	ErrAlreadyExists      = errAlreadyExists{}
	ErrPermissionDenied   = errPermissionDenied{}
	ErrResourceExhausted  = errResourceExhausted{}
	ErrFailedPrecondition = errFailedPrecondition{}
	ErrConflict           = errConflict{}
	ErrNotModified        = errNotModified{}
	ErrAborted            = errAborted{}
	ErrOutOfRange         = errOutOfRange{}
	ErrNotImplemented     = errNotImplemented{}
	ErrInternal           = errInternal{}
	ErrUnavailable        = errUnavailable{}
	ErrDataLoss           = errDataLoss{}
	ErrUnauthenticated    = errUnauthorized{}
)

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 IsAborted added in v0.2.0

func IsAborted(err error) bool

IsAborted returns true if an operation was aborted.

func IsAlreadyExists

func IsAlreadyExists(err error) bool

IsAlreadyExists returns true if the error is due to an already existing metadata item

func IsCanceled

func IsCanceled(err error) bool

IsCanceled returns true if the error is due to `context.Canceled`.

func IsConflict added in v0.2.0

func IsConflict(err error) bool

IsConflict returns true if an operation could not proceed due to a conflict.

func IsDataLoss added in v0.2.0

func IsDataLoss(err error) bool

IsDataLoss returns true if data during an operation was lost or corrupted

func IsDeadlineExceeded

func IsDeadlineExceeded(err error) bool

IsDeadlineExceeded returns true if the error is due to `context.DeadlineExceeded`.

func IsFailedPrecondition

func IsFailedPrecondition(err error)