pub enum WslError {
Show 25 variants
UnsupportedPlatform {
operation: &'static str,
},
Spawn {
program: PathBuf,
source: Error,
},
ChildControl {
program: PathBuf,
source: Error,
},
SecretInCommandLine {
program: PathBuf,
location: String,
},
CommandFailed {
what: &'static str,
program: PathBuf,
exit_code: Option<i32>,
detail: String,
},
InvalidName {
requested: String,
reason: String,
},
NotInstalled {
requested: String,
available: Vec<String>,
},
AmbiguousName {
requested: String,
},
NotWsl2 {
distribution: String,
version: u8,
},
NoRootAccess {
distribution: String,
detail: String,
},
UnsupportedArchitecture {
distribution: String,
reported: String,
},
SystemdUnavailable {
distribution: String,
detail: String,
},
UnreadableChecksums {
detail: String,
},
NoSuchArtifact {
version: String,
triple: String,
published: usize,
},
AmbiguousArtifact {
version: String,
triple: String,
count: usize,
},
UnreadableArchive {
path: PathBuf,
detail: String,
},
DigestMismatch {
path: PathBuf,
expected: String,
actual: String,
},
InvalidDestination {
path: String,
reason: String,
},
VersionMismatch {
expected: String,
reported: String,
},
ForeignTask {
name: String,
detail: String,
},
NoSuchTask {
name: String,
},
TaskControl {
operation: &'static str,
name: String,
detail: String,
},
NeedsElevation {
operation: &'static str,
name: String,
detail: String,
},
Record {
operation: &'static str,
path: PathBuf,
detail: String,
},
RecordSchema {
path: PathBuf,
found: u32,
supported: u32,
},
}Expand description
Anything that can go wrong managing a WSL distribution.
One enum rather than one per module: every variant here is something an
operator reads on their own terminal, and a chain of From conversions
between six error types would add wrapping without adding a single fact.
The variants are ordered as the work is: platform, process, discovery,
preflight, artifact, task, record.
Variants§
UnsupportedPlatform
This build is not for Windows, so there is no WSL to manage.
Spawn
The program could not be launched at all.
ChildControl
Waiting on or killing a child failed.
SecretInCommandLine
The stdin payload was about to be visible in a process listing.
Deliberately does not quote the payload: an error message is one of the
places 03-security-and-lifecycle.md says it must not appear.
Fields
CommandFailed
A program ran and refused.
Fields
InvalidName
The distribution name cannot be used at all.
NotInstalled
No distribution of that name is installed.
AmbiguousName
Two rows carry the name, so there is nothing safe to act on.
NotWsl2
The distribution is not WSL2.
NoRootAccess
The distribution does not start as root.
UnsupportedArchitecture
The distribution’s architecture has no published artifact.
systemd is not running the distribution.
UnreadableChecksums
The checksum document could not be read.
NoSuchArtifact
The release publishes nothing for this version and architecture.
Fields
AmbiguousArtifact
The release publishes more than one archive for this target.
Fields
UnreadableArchive
The archive on disk could not be read.
DigestMismatch
The archive is not the one that was published.
Fields
InvalidDestination
The destination path cannot be installed to.
VersionMismatch
The unpacked binary is not the version that was selected.
Fields
ForeignTask
A task of the product’s name exists and is somebody else’s.
NoSuchTask
There is no such task registered.
TaskControl
Task Scheduler refused.
Fields
NeedsElevation
Task Scheduler refused for want of privilege.
Fields
Record
A provider record could not be read or written.
Fields
RecordSchema
A provider record was written by a version this one does not know.
Implementations§
Source§impl WslError
impl WslError
Sourcepub fn kind(&self) -> &'static str
pub fn kind(&self) -> &'static str
A short, stable token for a status document or a log field.
Stable across message rewordings, which the prose above is not.
Sourcepub fn is_preflight(&self) -> bool
pub fn is_preflight(&self) -> bool
Whether this failure happened before anything was changed.
The column 03-security-and-lifecycle.md’s failure table is really
about: an operator wants to know whether to clean something up before
rerunning, and for every variant here the answer is “no” — the
mutating steps report Self::CommandFailed, Self::TaskControl or
Self::Record, and each of those is documented at its call site with
what it left behind.
Trait Implementations§
Source§impl Error for WslError
impl Error for WslError
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()