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
|
//! Errors returned from functions in this crate.
use std::path::PathBuf;
#[derive(Debug, thiserror::Error)]
pub enum JournalError {
/// Configuration file does not exist.
#[error("specified configuration file does not exist: {0}")]
ConfigMissing(PathBuf),
/// Failed to read the configuration file.
///
/// This is for permission problems and such.
#[error("failed to read configuration file {0}")]
ReadConfig(PathBuf, #[source] std::io::Error),
/// Configuration file has a syntax error.
#[error("failed to understand configuration file syntax: {0}")]
ConfigSyntax(PathBuf, #[source] serde_yaml::Error),
/// The specified directory does not look like a journal.
#[error("directory {0} is not a journal")]
NotAJournal(String),
/// Failed to create the directory for the journal.
#[error("failed to create journal directory {0}")]
CreateDirectory(PathBuf, #[source] std::io::Error),
/// To many drafts.
#[error("there are already {0} drafts in {1}, can't create more")]
TooManyDrafts(usize, PathBuf),
/// User chose a draft that doesn't exist.
#[error("No draft {0} in {1}")]
NoSuchDraft(String, PathBuf),
/// Failed to read draft.
#[error("failed to drafts {0}: {1}")]
ReadDraft(PathBuf, #[source] std::io::Error),
/// Draft is not UTF8.
#[error("draft {0} is not UTF8: {1}")]
DraftNotUUtf8(PathBuf, #[source] std::string::FromUtf8Error),
/// Failed to get metadata for specific file in drafts folder.
#[error("failed to stat draft in {0}: {1}")]
StatDraft(PathBuf, #[source] std::io::Error),
/// Error spawning editor.
#[error("failed to start editor {0}: {1}")]
SpawnEditor(PathBuf, #[source] std::io::Error),
/// Editor failed.
#[error("editor {0} failed: {1}")]
EditorFailed(PathBuf, String),
}
|