pub enum BadProfile {
InvalidName {
name: String,
},
Missing {
name: String,
dir: PathBuf,
},
}Expand description
Why a profile name cannot be used.
Returned rather than flattened into a message so a caller wording the refusal
itself, e.g. to offer to create the profile, gets the reason and the path it
would go at instead of a sentence it would have to re-derive both from.
Travels inside Error::BadProfile out of operations that have other ways
to fail, so no such operation has to give up its single error type or its
composition to keep the reason intact.
Deliberately not #[non_exhaustive], matching super::NotRemovable: a
caller that words each refusal should stop compiling when a new reason
appears, rather than printing a generic fallback for a case nobody worded.
Error being #[non_exhaustive] does not weaken that: the wildcard arm a
client needs there is for other kinds of failure, not for other refusals.
Variants§
InvalidName
The name is not a safe single path component, so it could escape the
profiles directory. See validate_name.
Missing
No profile directory exists at dir.
Trait Implementations§
Source§impl Debug for BadProfile
impl Debug for BadProfile
Source§impl Display for BadProfile
impl Display for BadProfile
Source§impl Error for BadProfile
impl Error for BadProfile
1.30.0 · 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()