pub enum FsError {
PathTraversal(PathBuf),
NotFound(PathBuf),
NotADirectory(PathBuf),
GlobPattern {
pattern: String,
reason: String,
},
GrepPattern {
pattern: String,
reason: String,
},
FileTooLarge {
path: PathBuf,
bytes: u64,
max: u64,
},
EditNotFound {
path: PathBuf,
},
EditAmbiguous {
path: PathBuf,
count: usize,
},
ParityDiffRequired {
path: PathBuf,
},
DiffHunkHeader {
reason: String,
},
DiffContextMismatch {
path: PathBuf,
line: usize,
reason: String,
},
Io {
path: PathBuf,
source: Error,
},
}Expand description
Errors produced by filesystem tools.
Why: A single error type for all three FS tools makes calling code concise
and lets ToolResult::err convert cleanly via Display.
What: Variants cover all failure modes: traversal, missing file, size cap,
IO, and unique-match violations.
Test: Each variant is exercised by at least one unit test in the tool modules.
Variants§
PathTraversal(PathBuf)
The requested path would escape the permitted working directory.
NotFound(PathBuf)
The file or directory was not found.
NotADirectory(PathBuf)
list_dir was pointed at a path that is not a directory.
GlobPattern
A glob/grep glob pattern failed to compile.
GrepPattern
A grep regular expression failed to compile.
FileTooLarge
The file exceeds the maximum allowed read size.
EditNotFound
edit found zero occurrences of old_string.
EditAmbiguous
edit found more than one occurrence of old_string.
ParityDiffRequired
HarnessMode::Parity (#2073) requires a diff payload and none was
supplied — SEARCH/REPLACE and whole-file payloads are ignored under
Parity, never used as a fallback.
DiffHunkHeader
A unified_diff edit’s hunk header (@@ -l,s +l,s @@) could not be parsed.
DiffContextMismatch
A unified_diff edit’s context or removal line did not match the
file’s current content at the expected position.
Io
Underlying IO 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()
Auto Trait Implementations§
impl !RefUnwindSafe for FsError
impl !UnwindSafe for FsError
impl Freeze for FsError
impl Send for FsError
impl Sync for FsError
impl Unpin for FsError
impl UnsafeUnpin for FsError
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more