pub enum FilesError {
FileNotFound {
path: String,
},
NotADirectory {
path: String,
},
InvalidPath {
path: String,
},
PathNotAbsolute {
path: String,
},
InvalidPathComponent {
path: String,
},
IoError {
path: String,
source: Error,
},
}Expand description
Errors that can occur during VFS operations.
All error variants include contextual information and implement
is_xxx() methods for easy error classification.
§Examples
use mcp_execution_files::FilesError;
let error = FilesError::FileNotFound {
path: "/missing.txt".to_string(),
};
assert!(error.is_not_found());Variants§
FileNotFound
File or directory not found at the specified path
NotADirectory
Path exists but is not a directory
InvalidPath
Path is invalid or malformed
PathNotAbsolute
Path is not absolute (must start with ‘/’)
InvalidPathComponent
Path contains invalid components (e.g., ‘..’)
IoError
I/O operation failed during filesystem export
Implementations§
Source§impl FilesError
impl FilesError
Sourcepub const fn is_not_found(&self) -> bool
pub const fn is_not_found(&self) -> bool
Returns true if this is a file not found error.
§Examples
use mcp_execution_files::FilesError;
let error = FilesError::FileNotFound {
path: "/test.txt".to_string(),
};
assert!(error.is_not_found());Sourcepub const fn is_not_directory(&self) -> bool
pub const fn is_not_directory(&self) -> bool
Returns true if this is a not-a-directory error.
§Examples
use mcp_execution_files::FilesError;
let error = FilesError::NotADirectory {
path: "/file.txt".to_string(),
};
assert!(error.is_not_directory());Sourcepub const fn is_invalid_path(&self) -> bool
pub const fn is_invalid_path(&self) -> bool
Returns true if this is an invalid path error.
§Examples
use mcp_execution_files::FilesError;
let error = FilesError::InvalidPath {
path: "".to_string(),
};
assert!(error.is_invalid_path());Sourcepub const fn is_io_error(&self) -> bool
pub const fn is_io_error(&self) -> bool
Returns true if this is an I/O error.
§Examples
use mcp_execution_files::FilesError;
use std::io;
let error = FilesError::IoError {
path: "/test.ts".to_string(),
source: io::Error::from(io::ErrorKind::PermissionDenied),
};
assert!(error.is_io_error());Trait Implementations§
Source§impl Debug for FilesError
impl Debug for FilesError
Source§impl Display for FilesError
impl Display for FilesError
Source§impl Error for FilesError
impl Error for FilesError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for FilesError
impl !RefUnwindSafe for FilesError
impl Send for FilesError
impl Sync for FilesError
impl Unpin for FilesError
impl UnsafeUnpin for FilesError
impl !UnwindSafe for FilesError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more