errormessages

package
v0.0.0-...-fb1fb40 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// error message patterns used by parsers
	PatternECRBatchGetImageError     = `denied: User: (.+) is not authorized to perform: ecr:BatchGetImage on resource`
	PatternImageDoesNotExistError    = `denied: requested access to the resource is denied`
	PatternNetworkConfigurationError = `request canceled while waiting for connection`
	// internal errors
	ErrorMessageDoesNotMatch = `ErrorMessageDoesNotMatch`
)

Variables

This section is empty.

Functions

func AugmentMessage

func AugmentMessage(errMsg string) string

Extend error messages with extra useful information. Tries to find known cases by matching `errMsg` against implemented parsers for known errors. If the error message pattern is unknown, returns the original error message.

Possible failure scenarios:

  1. Missing parser implementation - this can only occur if a new ErrorType was added incorrectly due to implementation oversight.

Currently, the function is set up in a safe manner - all failures are ignored, and the original error message string is returned.

func AugmentNamedErrMsg

func AugmentNamedErrMsg(namedErr apierrors.NamedError) apierrors.NamedError

Extend error with extra useful information. Works with NamedErrors.

Types

type AugmentableNamedError

type AugmentableNamedError interface {
	apierrors.NamedError
	WithAugmentedErrorMessage(string) apierrors.NamedError
}

An interface that provides means to reconstruct Named Errors. This is used during error message augmentation process.

type DockerError

type DockerError struct {
	Type     DockerErrorType
	RawError string
}

type DockerErrorType

type DockerErrorType int

DockerErrorType represents the type of error returned by Docker client.

const (
	MissingECRBatchGetImageError DockerErrorType = iota
	ECRImageDoesNotExistError
	NetworkConfigurationError
)

type ErrorMessageFunc

type ErrorMessageFunc func(errorData DockerError) string

Defines the function signature for generating formatted error messages.

Jump to

Keyboard shortcuts

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