Documentation
¶
Overview ¶
Package errors defines the public typed error categories, wrappers, and inspection helpers used throughout mischcore.
The package provides:
- stable category sentinels such as not found, conflict, partial failure, cancelled, not supported, and irreversible
- OperationError wrappers that retain operation name plus path context
- batch-error support that preserves errors.Is / errors.As behavior for aggregated per-item failures
- helper predicates and accessors so callers do not need to parse error strings or reach into internal implementations
- privilege classification helpers that let callers distinguish local permission failures that may be retryable through an admin handoff from remote or unsupported-backend failures
CLI and GUI consumers should prefer these helpers when branching on failure behavior instead of matching concrete backend errors directly.
Index ¶
- Variables
- func DiagnosticMessage(err error) string
- func IsAdminRequired(err error) bool
- func IsAlreadyExists(err error) bool
- func IsBusy(err error) bool
- func IsCancelled(err error) bool
- func IsConflict(err error) bool
- func IsCrossDevice(err error) bool
- func IsDirectory(err error) bool
- func IsIO(err error) bool
- func IsInvalidPath(err error) bool
- func IsIrreversible(err error) bool
- func IsNameTooLong(err error) bool
- func IsNoSpace(err error) bool
- func IsNotDirectory(err error) bool
- func IsNotFound(err error) bool
- func IsNotSupported(err error) bool
- func IsPartial(err error) bool
- func IsPermission(err error) bool
- func IsReadOnly(err error) bool
- func IsResourceLimit(err error) bool
- func IsTooManySymlinks(err error) bool
- func Kind(err error) string
- func NeedsLocalAdmin(err error, backend BackendKind) bool
- func NewBatch(errs ...error) error
- func Operation(err error) string
- func Path(err error) string
- func SourcePath(err error) string
- func TargetPath(err error) string
- func Wrap(op, path string, err error) error
- func WrapPaths(op, sourcePath, targetPath string, err error) error
- type BackendKind
- type BatchError
- type MutationNotStartedError
- type MutationOutcomeError
- type OperationError
- type PrivilegeAction
- type PrivilegeRequirement
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = stderrors.New("not found") ErrAlreadyExists = stderrors.New("already exists") ErrPermission = stderrors.New("permission denied") ErrAdminRequired = stderrors.New("admin privileges required") ErrInvalidPath = stderrors.New("invalid path") ErrCancelled = stderrors.New("cancelled") ErrNotSupported = stderrors.New("not supported") ErrConflict = stderrors.New("conflict") ErrIO = stderrors.New("io failure") ErrPartial = stderrors.New("partial failure") ErrReadOnly = stderrors.New("read-only filesystem") ErrNoSpace = stderrors.New("no space left on device") ErrNotDirectory = stderrors.New("not a directory") ErrIsDirectory = stderrors.New("is a directory") ErrNameTooLong = stderrors.New("file name too long") ErrTooManySymlinks = stderrors.New("too many symbolic links") ErrCrossDevice = stderrors.New("cross-device operation") ErrBusy = stderrors.New("resource busy") ErrResourceLimit = stderrors.New("resource limit exceeded") // ErrMutationUncertain marks a possible or partial mutation whose complete // effect cannot be reliably reconstructed. It does not establish an Undo // target. Join it with the underlying causes (and ErrPartial when applicable). // Existence/conflict helpers must not treat child causes as definitive root // outcomes; errors.Is still exposes those causes for diagnostics. ErrMutationUncertain = stderrors.New("mutation outcome uncertain") // ErrIrreversible marks an operation as no longer undoable/redoable because // the external world has changed (e.g. paths removed or replaced by other // processes). Consumers may prune such entries from undo/redo history. ErrIrreversible = stderrors.New("irreversible") )
Functions ¶
func DiagnosticMessage ¶
DiagnosticMessage describes known causes without exposing dependency messages or paths that may contain credentials. It bounds traversal of batch failures.
func IsAdminRequired ¶
func IsAlreadyExists ¶
IsAlreadyExists classifies a definitive rejected creation. An uncertain mutation may contain an existing child without establishing that outcome.
func IsCancelled ¶
func IsConflict ¶
IsConflict excludes uncertain mutations so a child conflict cannot authorize a retry or be mistaken for a rejected root operation.
func IsCrossDevice ¶
func IsDirectory ¶
func IsInvalidPath ¶
func IsIrreversible ¶
func IsNameTooLong ¶
func IsNotDirectory ¶
func IsNotFound ¶
IsNotFound classifies a definitive absence, not a child failure within a mutation whose overall effect is uncertain.
func IsNotSupported ¶
func IsPermission ¶
func IsReadOnly ¶
func IsResourceLimit ¶
func IsTooManySymlinks ¶
func NeedsLocalAdmin ¶
func NeedsLocalAdmin(err error, backend BackendKind) bool
func SourcePath ¶
func TargetPath ¶
Types ¶
type BackendKind ¶
type BackendKind string
const ( BackendUnknown BackendKind = "" BackendLocal BackendKind = "local" BackendRemote BackendKind = "remote" BackendDevice BackendKind = "device" )
type BatchError ¶
type BatchError struct {
// contains filtered or unexported fields
}
func (*BatchError) Error ¶
func (e *BatchError) Error() string
func (*BatchError) Errors ¶
func (e *BatchError) Errors() []error
func (*BatchError) Unwrap ¶
func (e *BatchError) Unwrap() []error
type MutationNotStartedError ¶
type MutationNotStartedError struct{ Err error }
MutationNotStartedError records a provider-confirmed failure before any mutation request was sent. It preserves the transport cause without claiming that an unacknowledged mutation may have committed. Providers must not use this marker once a request that can change storage has been issued.
func (*MutationNotStartedError) Error ¶
func (e *MutationNotStartedError) Error() string
func (*MutationNotStartedError) Unwrap ¶
func (e *MutationNotStartedError) Unwrap() error
type MutationOutcomeError ¶
MutationOutcomeError separates the mutation reply from failed recovery observation. Both causes remain available through errors.Is/errors.As. A nil MutationErr means the write reported success but its complete effect could not be confirmed. Observation cancellation/deadline is not execution cancellation; engine lifecycle classification must use MutationErr.
func (*MutationOutcomeError) Error ¶
func (e *MutationOutcomeError) Error() string
func (*MutationOutcomeError) Unwrap ¶
func (e *MutationOutcomeError) Unwrap() []error
type OperationError ¶
func (*OperationError) Error ¶
func (e *OperationError) Error() string
func (*OperationError) Unwrap ¶
func (e *OperationError) Unwrap() error
type PrivilegeAction ¶
type PrivilegeAction string
const ( PrivilegeActionNone PrivilegeAction = "" PrivilegeActionLocalAdmin PrivilegeAction = "local_admin" )
type PrivilegeRequirement ¶
type PrivilegeRequirement struct {
Required bool
Action PrivilegeAction
Backend BackendKind
Operation string
Path string
SourcePath string
TargetPath string
Reason string
}
func ClassifyPrivilegeRequirement ¶
func ClassifyPrivilegeRequirement(err error, backend BackendKind) PrivilegeRequirement