errors

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package errors provides custom error types for the godock client

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a resource is not found
	ErrNotFound = errors.New("resource not found")
	// ErrAlreadyExists is returned when attempting to create a resource that already exists
	ErrAlreadyExists = errors.New("resource already exists")
	// ErrInvalidConfig is returned when a configuration is invalid
	ErrInvalidConfig = errors.New("invalid configuration")
	// ErrDaemonNotRunning is returned when the Docker daemon is not running
	ErrDaemonNotRunning = errors.New("docker daemon is not running")
	// ErrTimeout is returned when an operation times out
	ErrTimeout = errors.New("operation timed out")
	// ErrCanceled is returned when an operation is canceled
	ErrCanceled = errors.New("operation canceled")
)

Functions

func IsAlreadyExists

func IsAlreadyExists(err error) bool

IsAlreadyExists returns true if the error is an already exists error

func IsCanceled

func IsCanceled(err error) bool

IsCanceled returns true if the error is a canceled error

func IsDaemonNotRunning

func IsDaemonNotRunning(err error) bool

IsDaemonNotRunning returns true if the error is a daemon not running error

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig returns true if the error is an invalid config error

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if the error is a not found error

func IsTimeout

func IsTimeout(err error) bool

IsTimeout returns true if the error is a timeout error

func New

func New(message string) error

New creates a new error with the given message

func Wrap

func Wrap(err error, message string) error

Wrap wraps an error with additional context

Types

type ConfigError

type ConfigError struct {
	Field   string
	Message string
}

ConfigError represents an invalid configuration error

func (*ConfigError) Error

func (e *ConfigError) Error() string

func (*ConfigError) Is

func (e *ConfigError) Is(target error) bool

Is implements the errors.Is interface

type ContainerError

type ContainerError struct {
	ID      string
	Op      string
	Message string
}

ContainerError represents a container-specific error

func (*ContainerError) Error

func (e *ContainerError) Error() string

type DaemonNotRunningError

type DaemonNotRunningError struct {
	Message string
}

DaemonNotRunningError represents an error when the Docker daemon is not running

func (*DaemonNotRunningError) Error

func (e *DaemonNotRunningError) Error() string

func (*DaemonNotRunningError) Is

func (e *DaemonNotRunningError) Is(target error) bool

Is implements the errors.Is interface

type ExecError

type ExecError struct {
	ID      string
	Op      string
	Message string
}

ExecError represents an exec-specific error

func (*ExecError) Error

func (e *ExecError) Error() string

type ImageError

type ImageError struct {
	Ref     string
	Op      string
	Message string
}

ImageError represents an image-specific error

func (*ImageError) Error

func (e *ImageError) Error() string

type NetworkError

type NetworkError struct {
	ID      string
	Op      string
	Message string
}

NetworkError represents a network-specific error

func (*NetworkError) Error

func (e *NetworkError) Error() string

type ResourceExistsError

type ResourceExistsError struct {
	ResourceType string
	ID           string
}

ResourceExistsError represents an already exists error for a specific resource

func (*ResourceExistsError) Error

func (e *ResourceExistsError) Error() string

func (*ResourceExistsError) Is

func (e *ResourceExistsError) Is(target error) bool

Is implements the errors.Is interface

type ResourceNotFoundError

type ResourceNotFoundError struct {
	ResourceType string
	ID           string
}

ResourceNotFoundError represents a not found error for a specific resource

func (*ResourceNotFoundError) Error

func (e *ResourceNotFoundError) Error() string

func (*ResourceNotFoundError) Is

func (e *ResourceNotFoundError) Is(target error) bool

Is implements the errors.Is interface

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

ValidationError represents a validation error

func (*ValidationError) Error

func (e *ValidationError) Error() string

func (*ValidationError) Is

func (e *ValidationError) Is(target error) bool

Is implements the errors.Is interface

type VolumeError

type VolumeError struct {
	Name    string
	Op      string
	Message string
}

VolumeError represents a volume-specific error

func (*VolumeError) Error

func (e *VolumeError) Error() string

Jump to

Keyboard shortcuts

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