Documentation
¶
Index ¶
- Variables
- func FromStderr(stderr string, exitCode int) error
- func GetElement(err error) string
- func Is(err, target error) bool
- func IsContext(err error) bool
- func IsRetryable(err error) bool
- func IsTimeoutError(err error) bool
- func Join(errs ...error) error
- func New(msg string) error
- func Reason(err error) string
- func ToCode(err error) codes.Code
- type Category
- type Element
- type StructuredError
Constants ¶
This section is empty.
Variables ¶
var ( ErrRetryable = errors.New("retryable error") ErrNoRetry = errors.New("no retry") // phases - used to wrap errors indicating which sync phase failed ErrPhasePreparing = errors.New("before update") ErrPhaseApplyingUpdate = errors.New("sync device") ErrPhaseActivatingConfig = errors.New("after update") // components - used to wrap errors indicating which component failed ErrComponentResources = errors.New("resources") ErrComponentDownloadPolicy = errors.New("download policy") ErrComponentUpdatePolicy = errors.New("update policy") ErrComponentPrefetch = errors.New("prefetch") ErrComponentApplications = errors.New("applications") ErrComponentHooks = errors.New("hooks") ErrComponentConfig = errors.New("config") ErrComponentSystemd = errors.New("systemd") ErrComponentLifecycle = errors.New("lifecycle") ErrComponentOS = errors.New("os") ErrComponentOSReconciled = errors.New("os reconciliation") // bootstrap ErrEnrollmentRequestFailed = errors.New("enrollment request failed") ErrEnrollmentRequestDenied = errors.New("enrollment request denied") // applications ErrAppNameRequired = errors.New("application name is required") ErrAppNotFound = errors.New("application not found") ErrUnsupportedAppType = errors.New("unsupported application type") ErrUnsupportedVolumeType = errors.New("unsupported volume type") ErrParseAppType = errors.New("failed to parse application type") ErrAppDependency = errors.New("failed to resolve application dependency") ErrUnsupportedAppProvider = errors.New("unsupported application provider") ErrAppLabel = errors.New("required label not found") ErrKubernetesAppsDisabled = errors.New("kubernetes applications disabled") // compose ErrNoComposeFile = errors.New("no valid compose file found") ErrNoComposeServices = errors.New("no services found in compose spec") // quadlet ErrNoQuadletFile = errors.New("no quadlet file found") ErrNoQuadletWorkload = errors.New("no quadlet workloads found") // application status ErrUnknownApplicationStatus = errors.New("unknown application status") // container images ErrImageShortName = errors.New("failed to resolve image short name: use the full name i.e registry/image:tag") // spec ErrMissingRenderedSpec = errors.New("missing rendered spec") ErrReadingRenderedSpec = errors.New("reading rendered spec") ErrWritingRenderedSpec = errors.New("writing rendered spec") ErrCheckingFileExists = errors.New("checking if file exists") ErrCopySpec = errors.New("copying spec") ErrGettingBootcStatus = errors.New("getting current bootc status") ErrGettingDeviceSpec = errors.New("getting device spec") ErrParseRenderedVersion = errors.New("failed to convert version to integer") ErrUnmarshalSpec = errors.New("unmarshalling spec") ErrInvalidSpecType = errors.New("invalid spec type") ErrInvalidSpec = errors.New("invalid spec") // hooks ErrInvalidTokenFormat = errors.New("invalid token: formatting") ErrTokenNotSupported = errors.New("invalid token: not supported") ErrActionTypeNotFound = errors.New("failed to find action type") ErrRunActionInvalid = errors.New("invalid run action") ErrUnsupportedFilesystemOperation = errors.New("unsupported filesystem operation") // networking ErrNoContent = errors.New("no content") ErrNilResponse = errors.New("received nil response") ErrNetwork = errors.New("network") // authentication ErrAuthenticationFailed = errors.New("authentication failed") // io ErrReadingPath = errors.New("failed reading path") ErrPathIsDir = errors.New("provided path is a directory") ErrNotFound = errors.New("not found") ErrNotExist = os.ErrNotExist ErrInvalidPath = errors.New("invalid path") // images ErrImageNotFound = errors.New("image not found") // policy ErrDownloadPolicyNotReady = errors.New("download policy not ready") ErrUpdatePolicyNotReady = errors.New("update policy not ready") ErrInvalidPolicyType = errors.New("invalid policy type") // prefetch ErrPrefetchNotReady = errors.New("oci prefetch not ready") ErrOCICollectorNotReady = errors.New("oci target collector not ready") // bootc ErrBootcStatusInvalidJSON = errors.New("bootc status did not return valid JSON") // Certificate management errors ErrCreateCertificateSigningRequest = errors.New("failed to create certificate signing request") // resource monitoring ErrCriticalResourceAlert = errors.New("critical resource alert") // policy errors ErrInt64Conversion = errors.New("convert string to int64") ErrNegativeValue = errors.New("cannot be negative") ErrPolicyCheckFailed = errors.New("policy check failed") // application errors ErrAppTypeMismatch = errors.New("app type mismatch") ErrAppProviders = errors.New("app providers") ErrCollectingEmbedded = errors.New("collecting embedded") ErrEnsuringAppType = errors.New("ensuring app type") ErrDetectingOCIType = errors.New("detecting oci type") ErrResolvingAppName = errors.New("resolving app name") ErrExtractingArtifact = errors.New("extracting artifact") ErrExtractingOCI = errors.New("extracting oci") ErrVerifyingImage = errors.New("verifying image") ErrEnsuringDependencies = errors.New("ensuring dependencies") ErrDecodingApplicationContent = errors.New("decoding application content") ErrReadingAuthFile = errors.New("reading auth file") ErrParsingAuthFile = errors.New("parsing auth file") ErrWritingInlineConfigFile = errors.New("writing inline config file") ErrWritingEnvFile = errors.New("writing env file") ErrGettingVolumes = errors.New("getting volumes") ErrCreatingTmpDir = errors.New("creating tmp dir") ErrGettingProviderSpec = errors.New("getting provider spec") ErrConvertInlineConfigProvider = errors.New("convert inline config provider") ErrExtractingNestedTargets = errors.New("extracting nested targets") ErrSchedulingPrefetchTargets = errors.New("scheduling prefetch targets") ErrGettingImageDigest = errors.New("getting image digest") ErrGettingArtifactDigest = errors.New("getting artifact digest") ErrPrefetchCollector = errors.New("prefetch collector") // config errors ErrFailedToRetrieveUserID = errors.New("failed to retrieve userid") ErrFailedToRetrieveGroupID = errors.New("failed to retrieve groupid") ErrFailedToRemoveObsoleteFiles = errors.New("failed to remove obsolete files") ErrDeletingFilesFailed = errors.New("deleting files failed") ErrConvertDesiredConfigToFiles = errors.New("convert desired config to files") ErrConvertCurrentConfigToFiles = errors.New("convert current config to files") ErrFailedConvertingGID = errors.New("failed converting gid") ErrFailedConvertingUID = errors.New("failed converting uid") ErrFailedRetrievingCurrentUser = errors.New("failed retrieving current user") // systemd errors ErrInvalidPatterns = errors.New("invalid patterns") // lifecycle/hooks errors ErrFailedToPushStatus = errors.New("failed to push status") ErrFailedToUpdateStatusWithDecommission = errors.New("failed to update status with decommission") ErrInvalidEnvvarFormat = errors.New("invalid envvar format") ErrExitCode = errors.New("exit code") ErrParsingHookActionsFrom = errors.New("parsing hook actions from") ErrReadingHookActionsFrom = errors.New("reading hook actions from") ErrUnknownHookActionType = errors.New("unknown hook action type") ErrUnknownHookConditionType = errors.New("unknown hook condition type") ErrFailedToExecute = errors.New("failed to execute") ErrLookingForHook = errors.New("looking for hook") // OS errors ErrUnableToParseImageReference = errors.New("unable to parse image reference into a valid bootc target") ErrStageImage = errors.New("stage image") ErrApplyImage = errors.New("apply image") // application lifecycle errors ErrParsingComposeSpec = errors.New("parsing compose spec") ErrParsingQuadletSpec = errors.New("parsing quadlet spec") ErrValidatingComposeSpec = errors.New("validating compose spec") ErrValidatingQuadletSpec = errors.New("validating quadlet spec") ErrRemovingApplication = errors.New("removing application") ErrInstallingApplication = errors.New("installing application") ErrCopyingImage = errors.New("copying image") ErrPermissionDenied = os.ErrPermission ErrDoesNotExist = os.ErrNotExist ErrReadOnlyFileSystem = syscall.EROFS ErrNoSpaceLeft = syscall.ENOSPC ErrDiskFull = errors.New("disk full") ErrFailedToDecode = errors.New("failed to decode") ErrFailedToParse = errors.New("failed to parse") ErrNoSuchFile = errors.New("no such file") ErrNonRetryable = errors.New("non-retryable") ErrNotSet = errors.New("not set") ErrIsRequired = errors.New("is required") ErrIsEmpty = errors.New("is empty") ErrMarshal = errors.New("marshal") // json marshalling error ErrPodmanFailed = errors.New("podman failed") ErrTime = errors.New("time:") // errorTypeToCode maps error types from stderrKeywords to status codes. ErrorTypeToCode = map[error]codes.Code{}/* 118 elements not displayed */ )
Functions ¶
func FromStderr ¶ added in v0.4.0
FromStderr converts stderr output from a command into an error type.
func GetElement ¶
GetElement extracts the element identifier from an error chain. Returns an empty string if no Element is found.
func IsRetryable ¶
TODO: tighten up the retryable errors ideally all retryable errors should be explicitly defined
func IsTimeoutError ¶
Types ¶
type Category ¶
type Category string
Category represents the high-level functional area describing WHAT failed.
const ( CategoryNetwork Category = "Network" CategoryConfiguration Category = "Configuration" CategoryFilesystem Category = "Filesystem" CategorySecurity Category = "Security" CategoryStorage Category = "Storage" CategoryResource Category = "Resource" CategorySystem Category = "System" CategoryUnknown Category = "Unknown" )
type Element ¶
type Element struct {
Value string
}
Element is an error type that carries an element identifier through the error chain. It implements the error interface so it can be wrapped and extracted via errors.As.
func WithElement ¶
WithElement creates a new Element error with the given identifier.
type StructuredError ¶
type StructuredError struct {
Phase error
Component error
Element string
Category Category
StatusCode codes.Code
Timestamp time.Time
}
StructuredError represents a formatted error for status display.
func FormatError ¶
func FormatError(err error) *StructuredError
FormatError extracts phase and component from the error chain.
func (*StructuredError) Message ¶
func (se *StructuredError) Message() string
Message returns the formatted error message string.