-
Notifications
You must be signed in to change notification settings - Fork 94
/
Copy patherror.rs
47 lines (36 loc) · 1.85 KB
/
error.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use thiserror::Error;
use std::io;
/// HoustonProblem is the type of Error that occured.
#[derive(Error, Debug)]
pub enum HoustonProblem {
/// ConfigDirNotFound occurs when the default OS config can't be found.
#[error("Could not determine default OS configuration directory.")]
DefaultConfigDirNotFound,
/// CouldNotCreateConfig occurs when a configuration directory could not be created.
#[error("Could not create a configuration directory at \"{0}\".")]
CouldNotCreateConfigHome(String),
/// InvalidOverrideConfigDir occurs when a user provides a path to a non-directory.
#[error("\"{0}\" already exists and is not a directory.")]
InvalidOverrideConfigDir(String),
/// NoConfigFound occurs when a global configuration directory can't be found.
#[error("Could not find a configuration directory at \"{0}\".")]
NoConfigFound(String),
/// ProfileNotFound occurs when a profile with a specified name can't be found.
#[error("There is no profile named \"{0}\".")]
ProfileNotFound(String),
/// NoProfilesFound occurs when there are no profiles at all, often for new users
#[error("No configuration profiles found")]
NoConfigProfiles,
/// NoNonSensitiveConfigFound occurs when non-sensitive config can't be found for a profile.
#[error("No non-sensitive configuration found for profile \"{0}\".")]
NoNonSensitiveConfigFound(String),
/// TomlSerialization occurs when a profile's configuration can't be serialized to a String.
#[error(transparent)]
TomlSerialization(#[from] toml::ser::Error),
/// TomlDeserialization occurs when a profile's configruation can't be deserialized from a String.
#[error(transparent)]
TomlDeserialization(#[from] toml::de::Error),
/// IOError occurs when any given std::io::Error arises.
#[error(transparent)]
IOError(#[from] io::Error),
}