errors

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package errors provides error types and utilities for the toolhive application.

Index

Constants

View Source
const (
	// ErrInvalidArgument is returned when an invalid argument is provided
	ErrInvalidArgument = "invalid_argument"

	// ErrContainerRuntime is returned when there is an error with the container runtime
	ErrContainerRuntime = "container_runtime"

	// ErrContainerNotFound is returned when a container is not found
	ErrContainerNotFound = "container_not_found"

	// ErrContainerAlreadyExists is returned when a container already exists
	ErrContainerAlreadyExists = "container_already_exists"

	// ErrContainerNotRunning is returned when a container is not running
	ErrContainerNotRunning = "container_not_running"

	// ErrContainerAlreadyRunning is returned when a container is already running
	ErrContainerAlreadyRunning = "container_already_running"

	// ErrRunConfigNotFound is returned when a run configuration is not found
	ErrRunConfigNotFound = "run_config_not_found"

	// ErrGroupAlreadyExists is returned when a group already exists
	ErrGroupAlreadyExists = "group_already_exists"

	// ErrGroupNotFound is returned when a group is not found
	ErrGroupNotFound = "group_not_found"

	// ErrTransport is returned when there is an error with the transport
	ErrTransport = "transport"

	// ErrPermissions is returned when there is an error with permissions
	ErrPermissions = "permissions"

	// ErrInternal is returned when there is an internal error
	ErrInternal = "internal"
)

Error types

Variables

This section is empty.

Functions

func IsContainerAlreadyExists

func IsContainerAlreadyExists(err error) bool

IsContainerAlreadyExists checks if the error is a container already exists error

func IsContainerAlreadyRunning

func IsContainerAlreadyRunning(err error) bool

IsContainerAlreadyRunning checks if the error is a container already running error

func IsContainerNotFound

func IsContainerNotFound(err error) bool

IsContainerNotFound checks if the error is a container not found error

func IsContainerNotRunning

func IsContainerNotRunning(err error) bool

IsContainerNotRunning checks if the error is a container not running error

func IsContainerRuntime

func IsContainerRuntime(err error) bool

IsContainerRuntime checks if the error is a container runtime error

func IsGroupAlreadyExists added in v0.2.3

func IsGroupAlreadyExists(err error) bool

IsGroupAlreadyExists checks if the error is a group already exists error

func IsGroupNotFound added in v0.2.3

func IsGroupNotFound(err error) bool

IsGroupNotFound checks if the error is a group not found error

func IsInternal

func IsInternal(err error) bool

IsInternal checks if the error is an internal error

func IsInvalidArgument

func IsInvalidArgument(err error) bool

IsInvalidArgument checks if the error is an invalid argument error

func IsPermissions

func IsPermissions(err error) bool

IsPermissions checks if the error is a permissions error

func IsRunConfigNotFound added in v0.2.1

func IsRunConfigNotFound(err error) bool

IsRunConfigNotFound checks if the error is a run configuration not found error

func IsTransport

func IsTransport(err error) bool

IsTransport checks if the error is a transport error

Types

type Error

type Error struct {
	// Type is the error type
	Type string

	// Message is the error message
	Message string

	// Cause is the underlying error
	Cause error
}

Error represents an error in the application

func NewContainerAlreadyExistsError

func NewContainerAlreadyExistsError(message string, cause error) *Error

NewContainerAlreadyExistsError creates a new container already exists error

func NewContainerAlreadyRunningError

func NewContainerAlreadyRunningError(message string, cause error) *Error

NewContainerAlreadyRunningError creates a new container already running error

func NewContainerNotFoundError

func NewContainerNotFoundError(message string, cause error) *Error

NewContainerNotFoundError creates a new container not found error

func NewContainerNotRunningError

func NewContainerNotRunningError(message string, cause error) *Error

NewContainerNotRunningError creates a new container not running error

func NewContainerRuntimeError

func NewContainerRuntimeError(message string, cause error) *Error

NewContainerRuntimeError creates a new container runtime error

func NewError

func NewError(errorType, message string, cause error) *Error

NewError creates a new error

func NewGroupAlreadyExistsError added in v0.2.3

func NewGroupAlreadyExistsError(message string, cause error) *Error

NewGroupAlreadyExistsError creates a new group already exists error

func NewGroupNotFoundError added in v0.2.3

func NewGroupNotFoundError(message string, cause error) *Error

NewGroupNotFoundError creates a new group not found error

func NewInternalError

func NewInternalError(message string, cause error) *Error

NewInternalError creates a new internal error

func NewInvalidArgumentError

func NewInvalidArgumentError(message string, cause error) *Error

NewInvalidArgumentError creates a new invalid argument error

func NewPermissionsError

func NewPermissionsError(message string, cause error) *Error

NewPermissionsError creates a new permissions error

func NewRunConfigNotFoundError added in v0.2.1

func NewRunConfigNotFoundError(message string, cause error) *Error

NewRunConfigNotFoundError creates a new run configuration not found error

func NewTransportError

func NewTransportError(message string, cause error) *Error

NewTransportError creates a new transport error

func (*Error) Error

func (e *Error) Error() string

Error returns the error message

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the underlying error

Jump to

Keyboard shortcuts

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