pub enum PathsError {
NoHomeDirectory,
Create {
purpose: &'static str,
path: PathBuf,
source: Error,
},
ParentDenies {
purpose: &'static str,
path: PathBuf,
parent_state: String,
source: Error,
},
}Expand description
Something went wrong resolving or creating an application-data directory.
Variants§
NoHomeDirectory
The operating system reported no home directory for this account.
Create
A directory could not be created.
Fields
ParentDenies
A directory could not be created because its parent refused.
Split out from PathsError::Create because the message a bare
EACCES produces is a dead end. It names the leaf, and the leaf is not
the obstacle: it does not exist yet, so it cannot be what refused.
mkdir(2) reports EACCES about the parent, and the parent here
is one of the shared directories this program deliberately does not
tighten – ~/.local, ~/.config, or whatever the account’s
application-data root resolves under. An operator handed the leaf path
goes and looks at a directory that is not there.
Nothing about the permission policy changes on the strength of this. Parents are still not this program’s to tighten, and this still fails rather than widening anything. The diagnosis is the whole of the remedy: say which directory refused and what state it is in, so the operator can decide.
Fields
path: PathBufThe leaf that could not be created. The directory that actually
refused is its parent, which is derived rather than stored: keeping
both is redundant, and it pushed Result<_, LoggingError> past
clippy’s result_large_err threshold, which is a fair complaint
about an error type carrying a path twice.
Trait Implementations§
Source§impl Debug for PathsError
impl Debug for PathsError
Source§impl Display for PathsError
impl Display for PathsError
Source§impl Error for PathsError
impl Error for PathsError
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()