diff options
author | Lukasz Woznicki <75632179+makr11st@users.noreply.github.com> | 2021-11-24 20:54:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-24 20:54:56 +0000 |
commit | a4ffeccf60090e4456755bc53a6e3b8c8038e855 (patch) | |
tree | 9583f187114913a92866571920dd3bb205bd50a3 /crates/core/c8y_smartrest/src/error.rs | |
parent | 8217e80670e76dbf9168780f5e0545355a39f8f3 (diff) |
Restructure directories of the workspace (#559)
* Restructure directories of the workspace
* Rename c8y_translator_lib to c8y_translator
* Update comment on how to get dummy plugin path
Signed-off-by: Lukasz Woznicki <lukasz.woznicki@softwareag.com>
Diffstat (limited to 'crates/core/c8y_smartrest/src/error.rs')
-rw-r--r-- | crates/core/c8y_smartrest/src/error.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/crates/core/c8y_smartrest/src/error.rs b/crates/core/c8y_smartrest/src/error.rs new file mode 100644 index 00000000..03fd5125 --- /dev/null +++ b/crates/core/c8y_smartrest/src/error.rs @@ -0,0 +1,35 @@ +use json_sm::SoftwareUpdateResponse; + +#[derive(thiserror::Error, Debug)] +pub enum SmartRestSerializerError { + #[error("The operation status is not supported. {response:?}")] + UnsupportedOperationStatus { response: SoftwareUpdateResponse }, + + #[error("Failed to serialize SmartREST.")] + InvalidCsv(#[from] csv::Error), + + #[error(transparent)] + FromCsvWriter(#[from] csv::IntoInnerError<csv::Writer<Vec<u8>>>), + + #[error(transparent)] + FromUtf8Error(#[from] std::string::FromUtf8Error), +} + +#[derive(thiserror::Error, Debug)] +pub enum SmartRestDeserializerError { + #[error("The received SmartREST message ID {id} is unsupported.")] + UnsupportedOperation { id: String }, + + #[error("Failed to deserialize SmartREST.")] + InvalidCsv(#[from] csv::Error), + + #[error("Jwt response contains incorrect ID: {0}")] + InvalidMessageId(u16), + + #[error("Parameter {parameter} is not recognized. {hint}")] + InvalidParameter { + operation: String, + parameter: String, + hint: String, + }, +} |