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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use crate::console;
use std::path::PathBuf;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum ConfigError {
#[error("{0}")]
UserConfigError(#[from] UserConfigError),
#[error("{0}")]
ProfileLoadError(#[from] ProfileLoadError),
#[error("{0}")]
ProfileWriteError(#[from] ProfileWriteError),
#[error("Invalid config error: {0}")]
InvalidConfigError(String),
#[error("Internal error: {0}")]
InternalError(String),
#[error("CS config dir was set to {0}, but the directory does not exist")]
MissingConfigDirError(PathBuf),
#[error("{0}")]
HomeDirError(String),
#[error("{0}")]
CredentialsError(String),
#[error("{0}")]
ConsoleError(#[from] console::WorkSpaceInfoError),
#[error("{0}")]
OtherError(String),
}
#[derive(Error, Debug)]
pub enum UserConfigError {
#[error("Invalid config.json: {0}")]
JSONError(#[from] serde_json::Error),
#[error("Error reading config.json: {0}")]
FSError(#[from] std::io::Error),
}
#[derive(Error, Debug)]
pub enum ProfileLoadError {
#[error("Invalid profile-config.json: {0}")]
JSONError(#[from] serde_json::Error),
#[error("Error reading profile-config.json: {0}")]
FSError(#[from] std::io::Error),
#[error("Profile not found: {0}")]
ProfileNotFoundError(String),
}
#[derive(Error, Debug)]
pub enum ProfileWriteError {
#[error("Failed to serialize profile as JSON: {0}")]
JSONError(#[from] serde_json::Error),
#[error("Error writing profile-config.json: {0}")]
FSError(#[from] std::io::Error),
#[error("Profile {0} already exists")]
AlreadyExists(String),
}