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;
/// Errors which can be caused by normal the-way operation.
/// Those caused by external libraries throw their own errors when possible
#[derive(Debug, Error)]
pub enum LostTheWay {
/// Thrown when trying to access an unrecorded language
#[error("I don't know what {language:?} is.")]
LanguageNotFound { language: String },
/// Thrown when trying to access a nonexistent snippet index
#[error("You haven't written that snippet: {index:?}.")]
SnippetNotFound { index: usize },
/// Thrown when trying to access an unrecorded tag
#[error("You haven't tagged anything as {tag:?} yet.")]
TagNotFound { tag: String },
/// Thrown when no text is returned from an external editor
#[error("EditorError")]
EditorError,
/// Thrown when explicit Y not received from user for destructive things
#[error("I'm a coward. Doing nothing.")]
DoingNothing,
/// Thrown when $HOME is not set
#[error("Homeless: $HOME not set")]
Homeless,
/// Thrown when trying to load a theme which hasn't been added / doesn't exist
#[error("ThemeError: {theme:?}")]
ThemeError { theme: String },
/// Thrown when trying to load a syntax which hasn't been added / doesn't exist
#[error("SyntaxError: {syntax:?}")]
SyntaxError { syntax: String },
#[error("ClipboardError: Couldn't copy to clipboard - {message}")]
ClipboardError { message: String },
#[error("SearchError: Search failed")]
SearchError,
/// Errors related to changing the configuration file
#[error("ConfigError: {message:?}")]
ConfigError { message: String },
/// Sync Error
#[error("SyncError: {message:?}")]
SyncError { message: String },
/// Error due to invalid Gist URL
#[error("GistUrlError: {message:?}")]
GistUrlError { message: String },
/// Catch-all for stuff that should never happen
#[error("OutOfCheeseError: {message:?}\nRedo from start.")]
OutOfCheeseError { message: String },
}