1use custom_error::custom_error;
5use std::fmt;
6
7#[derive(Debug)]
8pub enum SettingsMode {
9 Headless,
10 Full,
11}
12
13impl fmt::Display for SettingsMode {
14 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15 write!(f, "SettingsMode :: {:?}", self)
16 }
17}
18
19custom_error! {pub GlyphError
20 InvalidGlyph{glyph: String} = "The glyph {glyph} doesn't seem to be a valid glyph.",
21 Unexpected = "Unexpected token"
22}
23custom_error! {pub IOError
24 StdErr{err: String} = "{err}",
25}
26custom_error! {pub StateError
27 StateGraphNotFound{file: String} = "The state-graph {file} was not found.",
28 StateNotFound{state: String} = "The state {state} was not found.",
29
30 StateGraphAlreadyExists = "A state-graph already exists.",
31 StateAlreadyExists{state: String} = "The state {state} already exists.",
32
33 InvalidStateGraph{file: String} = "The state-graph {file} seems to be invalid.",
34 InvalidState{state: String} = "The state {state} seems to be invalid.",
35
36 EmptyStateList = "No states were found.",
37
38}
39custom_error! {pub PluginError
40 PluginNotFound{plugin: String} = "The plugin {plugin} was not found.",
41}
42
43custom_error! {pub SettingsError
44 WorkingDirNotFound = "The Godwit working directory was not found.",
45 SettingsNotFound{file: String} = "The settings {file} was not found.",
46
47 SettingsAlreadyExists{mode: SettingsMode} = "The settings of type {mode} already exist.",
48
49 InvalidSettings{file: String} = "The settings {file} seems to be invalid.",
50
51 DisallowedUpsert = "Disallowd because upsert option wasn't passed.",
52 DisallowedHeadless = "Disallowed because the operation isn't permitted on headless usage."
53}