pub enum GrabError {
TargetPathNotFound(PathBuf),
IoError {
path: PathBuf,
source: Error,
},
GitCommandError {
command: String,
stderr: String,
stdout: String,
},
GitExecutionError {
command: String,
source: Error,
},
NonUtf8File(PathBuf),
RepoRootNotFound(PathBuf),
GlobMatcherBuildError(Error),
WalkdirError {
path_display: String,
source_str: String,
},
}Expand description
Errors that can occur during the dirgrab library operations.
These errors cover issues ranging from file system access problems to Git command failures and configuration errors.
Variants§
TargetPathNotFound(PathBuf)
The initial target_path provided in the GrabConfig was not found
on the filesystem or was inaccessible due to permissions.
IoError
An I/O error occurred while accessing a path during the operation (e.g., reading a file, canonicalizing a path).
GitCommandError
A git command (like git ls-files or git rev-parse) failed to execute
successfully, indicated by a non-zero exit status.
Contains the command string, stderr, and stdout output for debugging.
GitExecutionError
An error occurred while trying to spawn or run the git process itself.
This commonly happens if git is not installed or not found in the system’s PATH,
but can also indicate permission errors preventing execution.
NonUtf8File(PathBuf)
A file identified for processing could not be read as valid UTF-8 data.
This usually indicates a binary file. In the default implementation of
grab_contents, such files are logged as a warning and skipped, rather
than returning this error directly.
RepoRootNotFound(PathBuf)
Although detect_git_repo attempts to handle cases where a path is not
in a repository gracefully (by returning Ok(None)), this error might
occur if an unexpected issue prevents determining the root definitively.
(Note: Current implementation less likely to return this specific variant).
GlobMatcherBuildError(Error)
Failed to build the glob pattern matcher from the patterns provided
in GrabConfig::exclude_patterns. This might happen if a pattern has
invalid syntax according to the ignore crate.
WalkdirError
An error occurred during directory traversal when operating in non-Git mode, likely related to permissions or accessing a specific directory entry. The default behavior logs a warning and skips the problematic entry.