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
use std::convert::Infallible;
#[derive(thiserror::Error, Debug)]
pub enum Error
{
// #[error("The remote service failed.")]
// ServiceFailed(String),
// #[error("Received an invalid message.")]
// InvalidMessage(String),
// #[error("Failed to parse a message.")]
// MessageParseError(String),
// #[error("An error occured when parsing bytes as Utf-8.")]
// Utf8Error(String),
// #[error("Future was cancelled.")]
// CancelledFuture(String),
#[error("Cannot cast {type_name} to {value}")]
InvalidValueCast
{
type_name: &'static str,
value: String,
},
#[error("IOError {0}")]
StdIO(#[from] std::io::Error),
#[error("Serialization error: {0}")]
JsonSerialization(#[from] serde_json::Error),
#[error("Serialization error: {0}")]
YamlSerialization(#[from] serde_saphyr::ser::Error),
// #[error("Serialization error: {0}")]
// CborSerializationError(#[from] ciborium::ser::Error<std::io::Error>),
#[cfg(feature = "mqtt")]
#[error("An error occured in the MQTT Service middleware: {0}.")]
MqttService(#[from] mqtt_service::Error),
#[cfg(feature = "http")]
#[error("An error occured during an HTTP Service request: {0}.")]
HttpService(#[from] reqwest::Error),
// #[error("Execution of the query failed with given error.")]
// QueryExecutionFailed(String),
#[error("UnsupportedNumber")]
UnsupportedNumber,
#[error("Infallible")]
Infallible(#[from] Infallible),
}