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
// SPDX-FileCopyrightText: OpenTalk GmbH <mail@opentalk.eu>
//
// SPDX-License-Identifier: EUPL-1.2
use std::path::PathBuf;
use snafu::Snafu;
/// The error returned from functions in this crate.
#[derive(Debug, Snafu)]
#[snafu(visibility(pub(crate)))]
pub enum DataError {
/// Data can't be loaded from a path.
#[snafu(display("Data can't be loaded from {path:?}"))]
NotLoadable {
/// The path from which the loading was attempted.
path: PathBuf,
/// The source error causing the failure.
source: std::io::Error,
},
/// Data can't be stored to a path.
#[snafu(display("Data can't be stored to {path:?}"))]
NotStorable {
/// The path to which the storing was attempted.
path: PathBuf,
/// The source error causing the failure.
source: std::io::Error,
},
/// The data folder can't be created under a path.
#[snafu(display("Data folder can't be created under {path:?}"))]
FolderNotCreatable {
/// The path that was attempted to be created.
path: PathBuf,
/// The source error causing the failure.
source: std::io::Error,
},
/// The system data home is not set.
#[snafu(display("System data home not set"))]
SystemDataHomeNotSet,
/// Data can't be read from a path.
#[snafu(display("Data not readable from {path:?}"))]
NotReadable {
/// The path from which the reading was attempted.
path: PathBuf,
/// The toml deserialization error causing the failure.
source: toml::de::Error,
},
/// Data can't be written to a path.
#[snafu(display("Data not writeable to {path:?}"))]
NotWriteable {
/// The path to which the writing was attempted.
path: PathBuf,
/// The toml serialization error causing the failure.
source: toml::ser::Error,
},
}