pub struct FsError { /* private fields */ }Expand description
Provider-neutral filesystem error with operation and path context.
Debug and Display never expand the retained source error because a
lower-level SDK or transport diagnostic may contain credentials. Debug
reports only whether a source exists; explicit diagnostic code may inspect
it through Error::source. The message supplied by constructors must
already be scrubbed of secret material.
§Examples
use qubit_fs::Path;
use qubit_fs::error::FsError;
use qubit_fs::error::FsErrorKind;
use qubit_fs::error::FsOperation;
let path = Path::parse("/reports/latest.csv")?;
let error = FsError::new(FsErrorKind::NotFound, FsOperation::Stat, "object missing")
.with_path(path.clone());
assert_eq!(FsErrorKind::NotFound, error.kind());
assert_eq!(Some(&path), error.path());Implementations§
Source§impl FsError
impl FsError
Sourcepub fn new(kind: FsErrorKind, operation: FsOperation, message: &str) -> Self
pub fn new(kind: FsErrorKind, operation: FsOperation, message: &str) -> Self
Sourcepub fn with_source<E>(
kind: FsErrorKind,
operation: FsOperation,
message: &str,
source: E,
) -> Self
pub fn with_source<E>( kind: FsErrorKind, operation: FsOperation, message: &str, source: E, ) -> Self
Creates a filesystem error that wraps a lower-level source error.
§Parameters
kind: Provider-neutral error category.operation: Operation that produced the error.message: Human-readable diagnostic message that must not contain credentials or other secret material.source: Lower-level error to preserve. Its formatting may contain secrets and is therefore never expanded by this type’sDebugorDisplayimplementation.
§Returns
New filesystem error with source context.
Sourcepub fn with_path(self, path: impl Into<Path>) -> Self
pub fn with_path(self, path: impl Into<Path>) -> Self
Adds primary path context.
§Parameters
path: Concrete path where the operation failed. For a two-path operation this may be either request path; useSelf::targetto identify the destination.
§Returns
Updated filesystem error.
Sourcepub fn with_operation(self, operation: FsOperation) -> Self
pub fn with_operation(self, operation: FsOperation) -> Self
Rebinds the error to the public operation that was requested.
This is useful for convenience operations implemented through another
primitive, such as exists implemented through stat, while retaining
all path, provider, capability, and source context.
§Parameters
operation: Public operation whose failure is being returned.
§Returns
Updated filesystem error.
Sourcepub fn with_target(self, target: impl Into<Path>) -> Self
pub fn with_target(self, target: impl Into<Path>) -> Self
Sourcepub fn with_failure_path(self, path: impl Into<Path>) -> Self
pub fn with_failure_path(self, path: impl Into<Path>) -> Self
Adds the concrete source entry where a structured operation failed.
Sourcepub fn with_failure_target(self, target: impl Into<Path>) -> Self
pub fn with_failure_target(self, target: impl Into<Path>) -> Self
Adds the concrete destination entry where a structured operation failed.
Sourcepub fn with_provider(self, provider: impl Display) -> Self
pub fn with_provider(self, provider: impl Display) -> Self
Sourcepub fn with_required_capability(self, capability: FileSystemCapability) -> Self
pub fn with_required_capability(self, capability: FileSystemCapability) -> Self
Sourcepub fn with_effect_state(self, effect_state: FsEffectState) -> Self
pub fn with_effect_state(self, effect_state: FsEffectState) -> Self
Sourcepub fn invalid_path(operation: FsOperation, message: &str) -> Self
pub fn invalid_path(operation: FsOperation, message: &str) -> Self
Sourcepub fn from_io(error: Error, operation: FsOperation) -> Self
pub fn from_io(error: Error, operation: FsOperation) -> Self
Sourcepub fn kind(&self) -> FsErrorKind
pub fn kind(&self) -> FsErrorKind
Sourcepub fn operation(&self) -> FsOperation
pub fn operation(&self) -> FsOperation
Sourcepub fn target(&self) -> Option<&Path>
pub fn target(&self) -> Option<&Path>
Returns the secondary target path associated with this error.
§Returns
The target path when one was attached.
Sourcepub fn failure_path(&self) -> Option<&Path>
pub fn failure_path(&self) -> Option<&Path>
Returns the concrete source entry where the operation failed.
§Returns
The structured source path when one was attached for copy, rename, or similar multi-path operations.
Sourcepub fn failure_target(&self) -> Option<&Path>
pub fn failure_target(&self) -> Option<&Path>
Returns the concrete destination entry where the operation failed.
§Returns
The structured destination path when one was attached for copy, rename, or similar multi-path operations.
Sourcepub fn provider(&self) -> Option<&str>
pub fn provider(&self) -> Option<&str>
Returns the provider associated with this error.
§Returns
The canonical provider id when one was attached.
Sourcepub fn required_capability(&self) -> Option<FileSystemCapability>
pub fn required_capability(&self) -> Option<FileSystemCapability>
Returns the required capability associated with this error.
§Returns
The capability when the error describes unsupported functionality or an unmet semantic requirement.
Sourcepub fn effect_state(&self) -> Option<FsEffectState>
pub fn effect_state(&self) -> Option<FsEffectState>
Returns the strongest known external effect of the failed operation.
§Returns
Some when a provider proved an effect state, or None when the error
carries no effect-state claim.
Sourcepub fn has_indeterminate_effect(&self) -> bool
pub fn has_indeterminate_effect(&self) -> bool
Returns whether the operation’s external effect cannot be determined.
Sourcepub fn into_io_error(self) -> Error
pub fn into_io_error(self) -> Error
Trait Implementations§
Source§impl Error for FsError
impl Error for FsError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()