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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
//
// imag - the personal information management suite for the commandline
// Copyright (C) 2015-2020 the imag contributors
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; version
// 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
use thiserror::Error;
pub type Result<T> = ::std::result::Result<T, Error>;
#[derive(Debug, Error)]
pub enum Error {
#[error("IO error")]
IO(#[from] ::std::io::Error),
#[error("Unknown IO error")]
UnknownIO,
#[error("Locking error")]
LockError,
#[error("Locking error")]
PoisonError,
#[error("UTF8 error")]
UTF8Error(#[from] std::str::Utf8Error),
#[error("Error in external process")]
ExternalProcessError,
#[error("File Error")]
FileError,
#[error("File not copied")]
FileNotCopied,
#[error("File not created")]
FileNotCreated,
#[error("File not found")]
FileNotFound,
#[error("Fail not removed")]
FileNotRemoved,
#[error("Fail not renamed")]
FileNotRenamed,
#[error("File not seeked")]
FileNotSeeked,
#[error("File not written")]
FileNotWritten,
#[error("Directory not created")]
DirNotCreated,
#[error("Formatting error")]
FormatError(#[from] std::fmt::Error),
#[error("ID is locked")]
IdLocked,
#[error("Error while converting values")]
ConversionError,
#[error("Entry exists already: {0}")]
EntryAlreadyExists(String),
#[error("Entry not found: {0}")]
EntryNotFound(String),
#[error("Entry header error")]
EntryHeaderError,
#[error("Entry header type error")]
EntryHeaderTypeError,
#[error("Entry header type error at '{0}', expected '{1}'")]
EntryHeaderTypeError2(&'static str, &'static str),
#[error("Entry header read error")]
EntryHeaderReadError,
#[error("Entry header write error")]
EntryHeaderWriteError,
#[error("Entry header field missing: {0}")]
EntryHeaderFieldMissing(&'static str),
#[error("Toml deserialization error")]
TomlDeserError,
#[error("Toml querying error")]
TomlQueryError,
}
|