#[non_exhaustive]pub enum FsError {
Show 26 variants
NotFound {
path: PathBuf,
},
ThreatDetected {
path: PathBuf,
reason: String,
},
AlreadyExists {
path: PathBuf,
operation: &'static str,
},
NotAFile {
path: PathBuf,
},
NotADirectory {
path: PathBuf,
},
DirectoryNotEmpty {
path: PathBuf,
},
InodeNotFound {
inode: u64,
},
InvalidHandle {
handle: Handle,
},
XattrNotFound {
path: PathBuf,
name: String,
},
PermissionDenied {
path: PathBuf,
operation: &'static str,
},
AccessDenied {
path: PathBuf,
reason: String,
},
ReadOnly {
operation: &'static str,
},
FeatureNotEnabled {
feature: &'static str,
operation: &'static str,
},
QuotaExceeded {
limit: u64,
requested: u64,
usage: u64,
},
FileSizeExceeded {
path: PathBuf,
size: u64,
limit: u64,
},
RateLimitExceeded {
limit: u32,
window_secs: u64,
},
InvalidData {
path: PathBuf,
details: String,
},
CorruptedData {
path: PathBuf,
details: String,
},
IntegrityError {
path: PathBuf,
},
Serialization(String),
Deserialization(String),
NotSupported {
operation: &'static str,
},
InvalidPassword,
Conflict {
path: PathBuf,
},
Backend(String),
Io {
operation: &'static str,
path: PathBuf,
source: Error,
},
}Expand description
Comprehensive filesystem error type.
All AnyFS operations return Result<T, FsError>. Each variant includes
relevant context (paths, operations, limits) to make debugging easier.
§Non-Exhaustive
This enum is marked #[non_exhaustive], meaning new variants may be added
in future versions without breaking changes. Always include a wildcard arm
when pattern matching:
use anyfs_backend::FsError;
use std::path::PathBuf;
fn handle_error(err: FsError) {
match err {
FsError::NotFound { path } => println!("Not found: {}", path.display()),
FsError::PermissionDenied { path, operation } => {
println!("Permission denied for {} on {}", operation, path.display())
}
other => println!("Other error: {}", other),
}
}§Display Format
All variants implement Display with human-readable messages:
use anyfs_backend::FsError;
use std::path::PathBuf;
let err = FsError::QuotaExceeded { limit: 100, requested: 50, usage: 80 };
let msg = err.to_string();
assert!(msg.contains("100") && msg.contains("50") && msg.contains("80"));§Error Source Chain
The Io variant wraps std::io::Error with the #[source]
attribute, enabling error chain traversal via std::error::Error::source().
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotFound
Path does not exist.
ThreatDetected
A threat was detected (e.g., path traversal, malicious content).
Fields
AlreadyExists
Path already exists when it shouldn’t.
Fields
NotAFile
Expected a file but found something else.
NotADirectory
Expected a directory but found something else.
DirectoryNotEmpty
Directory is not empty when it should be.
InodeNotFound
Inode does not exist.
InvalidHandle
File handle is invalid or closed.
XattrNotFound
Extended attribute not found.
Fields
PermissionDenied
Permission denied for operation.
Fields
AccessDenied
Access denied with reason.
ReadOnly
Filesystem is read-only.
FeatureNotEnabled
Feature is not enabled.
Fields
QuotaExceeded
Quota exceeded.
Fields
FileSizeExceeded
File size limit exceeded.
RateLimitExceeded
Rate limit exceeded.
InvalidData
Invalid data encountered.
CorruptedData
Corrupted data detected.
IntegrityError
Data integrity check failed.
Serialization(String)
Serialization error.
Deserialization(String)
Deserialization error.
NotSupported
Operation is not supported.
InvalidPassword
Invalid password provided.
Conflict
Conflict detected (e.g., concurrent modification).
Backend(String)
Generic backend error.
Io
I/O error with context.