summaryrefslogtreecommitdiffstats
path: root/lib/core/libimagerror/src/errors.rs
blob: a1373d9101336001ee7790a7794667b9ea818b1d (plain)
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
//
// 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
//

#[derive(Debug, Clone, Eq, PartialEq, Fail)]
pub enum ErrorMsg {
    #[fail(display = "IO Error")]
    IO,

    #[fail(display = "Locking error")]
    LockError,

    #[fail(display = "UTF8 error")]
    UTF8Error,

    #[fail(display = "Error in external process")]
    ExternalProcessError,

    #[fail(display = "File Error")]
    FileError,

    #[fail(display = "File not copied")]
    FileNotCopied,

    #[fail(display = "File not created")]
    FileNotCreated,

    #[fail(display = "File not found")]
    FileNotFound,

    #[fail(display = "Fail not removed")]
    FileNotRemoved,

    #[fail(display = "Fail not renamed")]
    FileNotRenamed,

    #[fail(display = "File not seeked")]
    FileNotSeeked,

    #[fail(display = "File not written")]
    FileNotWritten,

    #[fail(display = "Directory not created")]
    DirNotCreated,


    #[fail(display = "Formatting error")]
    FormatError,


    #[fail(display = "ID is locked")]
    IdLocked,

    #[fail(display = "Error while converting values")]
    ConversionError,


    #[fail(display = "Entry exists already: {}", _0)]
    EntryAlreadyExists(String),

    #[fail(display = "Entry not found: {}", _0)]
    EntryNotFound(String),

    #[fail(display = "Entry header error")]
    EntryHeaderError,

    #[fail(display = "Entry header type error")]
    EntryHeaderTypeError,

    #[fail(display = "Entry header type error at '{}', expected '{}'", _0, _1)]
    EntryHeaderTypeError2(&'static str, &'static str),

    #[fail(display = "Entry header read error")]
    EntryHeaderReadError,

    #[fail(display = "Entry header write error")]
    EntryHeaderWriteError,

    #[fail(display = "Entry header field missing: {}", _0)]
    EntryHeaderFieldMissing(&'static str),


    #[fail(display = "Toml deserialization error")]
    TomlDeserError,

    #[fail(display = "Toml querying error")]
    TomlQueryError,

}