summaryrefslogtreecommitdiffstats
path: root/lib/entry/libimagentrylink/src/error.rs
blob: 6f27f92a1ea74ed3ba7cd8fe6faec2b4ca13aa58 (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
//
// imag - the personal information management suite for the commandline
// Copyright (C) 2015, 2016 Matthias Beyer <mail@beyermatthias.de> and 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 libimagstore::storeid::StoreId;

error_chain! {
    types {
        LinkError, LinkErrorKind, ResultExt, Result;
    }

    errors {
        EntryHeaderReadError    {
            description("Error while reading an entry header")
            display("Error while reading an entry header")
        }

        EntryHeaderWriteError   {
            description("Error while writing an entry header")
            display("Error while writing an entry header")
        }

        ExistingLinkTypeWrong   {
            description("Existing link entry has wrong type")
            display("Existing link entry has wrong type")
        }

        LinkTargetDoesNotExist  {
            description("Link target does not exist in the store")
            display("Link target does not exist in the store")
        }

        LinkParserError         {
            description("Link cannot be parsed")
            display("Link cannot be parsed")
        }

        LinkParserFieldMissingError {
            description("Link cannot be parsed: Field missing")
            display("Link cannot be parsed: Field missing")
        }

        LinkParserFieldTypeError {
            description("Link cannot be parsed: Field type wrong")
            display("Link cannot be parsed: Field type wrong")
        }

        InternalConversionError {
            description("Error while converting values internally")
            display("Error while converting values internally")
        }

        InvalidUri              {
            description("URI is not valid")
            display("URI is not valid")
        }

        StoreReadError          {
            description("Store read error")
            display("Store read error")
        }

        StoreWriteError         {
            description("Store write error")
            display("Store write error")
        }

        StoreIdError            {
            description("StoreId handling error")
            display("StoreId handling error")
        }

        DeadLink(from: StoreId, to: StoreId) {
            description("Dead link")
            display("Dead link from: {from} to: {to}", from = from, to = to)
        }

        LinkHandlingError {
            description("Error in link handling")
            display("Error in link handling")
        }

        StoreError {
            description("Error while talking to the store")
            display("Error while talking to the store")
        }
    }
}