diff options
author | initard <solo@softwareag.com> | 2022-02-01 17:49:53 +0100 |
---|---|---|
committer | initard <solo@softwareag.com> | 2022-02-15 11:43:49 +0000 |
commit | 2411743f17e14fa6031d4940d6a0135abdc00baf (patch) | |
tree | ddc7782f8e72a4a3b4531585ec93779bfaf0c05c /crates/core/c8y_smartrest/src/error.rs | |
parent | ae402f67527d022a3cedd60f049d73724079850a (diff) |
c8y_api lib, tedge config, mqtt/http utilities (#790)
Preparing the repo for the log request plugin. Restructuring
folders, moving code out of sm_c8y_mapper and into c8y_api,
c8y_smartrest or tedge_config.
Signed-off-by: initard <solo@softwareag.com>
Diffstat (limited to 'crates/core/c8y_smartrest/src/error.rs')
-rw-r--r-- | crates/core/c8y_smartrest/src/error.rs | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/crates/core/c8y_smartrest/src/error.rs b/crates/core/c8y_smartrest/src/error.rs index ee52f984..9531f372 100644 --- a/crates/core/c8y_smartrest/src/error.rs +++ b/crates/core/c8y_smartrest/src/error.rs @@ -1,4 +1,5 @@ use agent_interface::SoftwareUpdateResponse; +use std::path::PathBuf; #[derive(thiserror::Error, Debug)] pub enum SmartRestSerializerError { @@ -39,3 +40,72 @@ pub enum SmartRestDeserializerError { #[error("Empty request")] EmptyRequest, } + +#[derive(Debug, thiserror::Error)] +pub enum OperationsError { + #[error(transparent)] + FromIo(#[from] std::io::Error), + + #[error("Cannot extract the operation name from the path: {0}")] + InvalidOperationName(PathBuf), + + #[error("Error while parsing operation file: '{0}': {1}.")] + TomlError(PathBuf, #[source] toml::de::Error), +} + +#[derive(thiserror::Error, Debug)] +pub enum SMCumulocityMapperError { + #[error("Invalid MQTT Message.")] + InvalidMqttMessage, + + #[error(transparent)] + InvalidTopicError(#[from] agent_interface::TopicError), + + #[error(transparent)] + InvalidThinEdgeJson(#[from] agent_interface::SoftwareError), + + #[error(transparent)] + FromElapsed(#[from] tokio::time::error::Elapsed), + + #[error(transparent)] + FromMqttClient(#[from] mqtt_channel::MqttError), + + #[error(transparent)] + FromReqwest(#[from] reqwest::Error), + + #[error(transparent)] + FromSmartRestSerializer(#[from] SmartRestSerializerError), + + #[error(transparent)] + FromSmartRestDeserializer(#[from] SmartRestDeserializerError), + + #[error(transparent)] + FromTedgeConfig(#[from] tedge_config::ConfigSettingError), + + #[error(transparent)] + FromLoadTedgeConfigError(#[from] tedge_config::TEdgeConfigError), + + #[error("Invalid date in file name: {0}")] + InvalidDateInFileName(String), + + #[error("Invalid path. Not UTF-8.")] + InvalidUtf8Path, + + #[error(transparent)] + FromIo(#[from] std::io::Error), + + #[error("Request timed out")] + RequestTimeout, + + #[error("Operation execution failed: {0}")] + ExecuteFailed(String), + + #[error("An unknown operation template: {0}")] + UnknownOperation(String), + + #[error(transparent)] + FromTimeFormat(#[from] time::error::Format), + + #[error(transparent)] + FromTimeParse(#[from] time::error::Parse), +} |