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
116
117
// use serde::{Deserialize, Serialize};
// use std::error::Error as StdError;
// use std::fmt::{Debug, Display};
// use std::result::Result as StdResult;
// pub type Result<T> = StdResult<T, Error>;
// use serde_json::Error as JsonError;
// pub type BoxedError = Box<dyn StdError + Send + Sync + 'static>;
// #[derive(Debug)]
// pub enum Error {
// /// For use with applicators and validators to use when an internal
// /// error occurs (e.g. unable to connect to a database, request timeout).
// Internal(Box<dyn StdError + Send + Sync + 'static>),
// /// An error occurred serializing or deserializing data.
// Serde(SerdeError),
// }
// impl Error {
// pub fn new_internal(err: impl StdError + Send + Sync + 'static) -> Self {
// Error::Internal(Box::new(err))
// }
// }
// impl From<JsonError> for Error {
// fn from(err: JsonError) -> Self {
// Error::Serde(SerdeError::from(err))
// }
// }
// // impl From<YamlError> for Error {
// // fn from(err: YamlError) -> Self {
// // Error::Serde(SerdeError::from(err))
// // }
// // }
// impl From<SerdeError> for Error {
// fn from(err: SerdeError) -> Self {
// Error::Serde(err)
// }
// }
// impl Display for Error {
// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
// match self {
// Error::Internal(err) => Display::fmt(err, f),
// Error::Serde(err) => Display::fmt(err, f),
// }
// }
// }
// impl StdError for Error {
// fn source(&self) -> Option<&(dyn StdError + 'static)> {
// match self {
// Error::Internal(err) => Some(err.as_ref()),
// Error::Serde(err) => Some(err),
// }
// }
// }
// /// A wrapper for serialization or deserialization errors in either JSON or
// /// YAML.
// #[derive(Debug)]
// pub enum SerdeError {
// Json(JsonError),
// // Yaml(YamlError),
// }
// impl From<JsonError> for SerdeError {
// fn from(err: JsonError) -> Self {
// SerdeError::Json(err)
// }
// }
// // impl From<YamlError> for SerdeError {
// // fn from(err: YamlError) -> Self {
// // SerdeError::Yaml(err)
// // }
// // }
// impl StdError for SerdeError {
// fn source(&self) -> Option<&(dyn StdError + 'static)> {
// match self {
// SerdeError::Json(err) => err.source(),
// // SerdeError::Yaml(err) => err.source(),
// }
// }
// }
// impl Display for SerdeError {
// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
// match self {
// SerdeError::Json(err) => std::fmt::Display::fmt(&err, f),
// // SerdeError::Yaml(err) => std::fmt::Display::fmt(&err, f),
// }
// }
// }
// #[derive(Clone)]
// pub enum IndexError {
// /// the schema does not contain an identifier (id) and thus can not be
// /// indexed
// NotIdentified,
// }
// impl Debug for IndexError {
// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
// match self {
// IndexError::NotIdentified => write!(f, "schema is not identifiable"),
// }
// }
// }
// impl Display for IndexError {
// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
// match self {
// IndexError::NotIdentified => write!(f, "schema is not identifiable"),
// }
// }
// }
// impl StdError for IndexError {}
// #[derive(Debug)]
// pub struct MissingLayerError();