#[non_exhaustive]pub enum PathError {
Show 17 variants
EmptyInput,
EmbeddedNul,
UndefinedEnvironmentVariable {
name: String,
},
MalformedEnvironmentVariable {
input: String,
},
HomeDirectoryUnavailable,
CurrentDirectoryUnavailable {
source: Error,
},
DriveRelativePath {
path: String,
},
AbsoluteChildPath {
path: String,
},
RootEscape {
path: String,
},
NotUtf8,
InvalidPath {
message: String,
},
Filesystem {
path: String,
source: Error,
},
Traversal {
message: String,
},
InvalidGlob {
message: String,
},
Cache {
message: String,
},
InvalidAppName {
message: String,
},
ExpansionDepthExceeded {
max_depth: u32,
},
}Expand description
Primary error type returned by path-rs APIs.
Errors include enough context to diagnose the failing path or operation. Third-party error types are not exposed as public fields unless necessary.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
EmptyInput
The provided path input was empty after optional trimming.
EmbeddedNul
The path contains an embedded NUL byte, which is invalid on all supported platforms.
UndefinedEnvironmentVariable
An environment variable referenced during expansion is not defined.
MalformedEnvironmentVariable
Environment variable syntax was malformed (e.g. unclosed %VAR or ${VAR).
Home directory could not be determined.
Current working directory could not be determined.
DriveRelativePath
A Windows drive-relative path such as C:foo or C: was encountered.
AbsoluteChildPath
An absolute child path was supplied where a relative path is required.
RootEscape
A path escapes the permitted root after normalization.
NotUtf8
A path is not valid UTF-8 and a UTF-8 conversion was requested.
InvalidPath
Generic invalid path condition with a human-readable message.
Filesystem
A filesystem operation failed.
Traversal
Directory traversal failed (permission, depth limit, etc.).
InvalidGlob
A glob pattern is invalid.
Cache
A cache operation failed.
InvalidAppName
Application name validation failed.
ExpansionDepthExceeded
Expansion exceeded the maximum allowed depth.
Implementations§
Source§impl PathError
impl PathError
Sourcepub fn filesystem(path: impl AsRef<Path>, source: Error) -> Self
pub fn filesystem(path: impl AsRef<Path>, source: Error) -> Self
Create a filesystem error for path wrapping source.
Sourcepub fn invalid(message: impl Into<String>) -> Self
pub fn invalid(message: impl Into<String>) -> Self
Create an invalid-path error with a message.
Sourcepub fn root_escape(path: impl AsRef<Path>) -> Self
pub fn root_escape(path: impl AsRef<Path>) -> Self
Create a root-escape error for path.
Sourcepub fn absolute_child(path: impl AsRef<Path>) -> Self
pub fn absolute_child(path: impl AsRef<Path>) -> Self
Create an absolute-child error for path.
Sourcepub fn drive_relative(path: impl AsRef<Path>) -> Self
pub fn drive_relative(path: impl AsRef<Path>) -> Self
Create a drive-relative error for path.
Trait Implementations§
Source§impl Error for PathError
impl Error for PathError
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()