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
use thiserror::Error;
#[derive(Error, Debug)]
pub enum SparseError {
#[error("The JSON pointer `{0}` is undefined")]
UnkownPath(String),
#[error("The value pointed by this pointer has changed since the last deserialization")]
OutdatedPointer,
#[error("An ill formed pointer was dereferenced")]
BadPointer,
#[error("The state has no root file")]
NoRoot,
#[error("The inner state is already mutably borrowed elsewhere")]
StateAlreadyBorrowed,
#[error("Referencing distant file is not possible for local reference")]
NoDistantFile,
#[error("A cyclic reference was stopped")]
CyclicRef,
#[error("Sparse cannot mutate a root element via a SparseValue")]
MuttatingRoot,
#[error("Cannot add that file to the state, it already exists")]
AlreadyExistsInState,
#[error("Cannot change the base path because it's already set")]
ChangingExistingBasePath,
#[error("File not in state")]
NotInState,
#[error(transparent)]
SerdeJson(#[from] serde_json::Error),
#[error(transparent)]
SerdeYaml(#[from] serde_yaml::Error),
#[error(transparent)]
Io(#[from] std::io::Error),
}