Heavily customized version of smokesignal - https://whtwnd.com/kayrozen.com/3lpwe4ymowg2t
1use thiserror::Error;
2
3/// Represents errors that can occur during data encoding and decoding operations.
4///
5/// These errors relate to serialization, deserialization, encoding and decoding
6/// of data across various formats used throughout the application.
7#[derive(Debug, Error)]
8pub enum EncodingError {
9 /// Error when JSON serialization fails.
10 ///
11 /// This error occurs when attempting to convert a Rust structure to
12 /// JSON format fails, typically due to data that cannot be properly
13 /// represented in JSON.
14 #[error("error-encoding-1 JSON serialization failed: {0:?}")]
15 JsonSerializationFailed(serde_json::Error),
16
17 /// Error when Base64 decoding fails.
18 ///
19 /// This error occurs when attempting to decode Base64-encoded data
20 /// that is malformed or contains invalid characters.
21 #[error("error-encoding-2 Base64 decoding failed: {0:?}")]
22 Base64DecodingFailed(base64::DecodeError),
23
24 /// Error when JSON deserialization fails.
25 ///
26 /// This error occurs when attempting to parse JSON data into a Rust
27 /// structure fails, typically due to missing fields, type mismatches,
28 /// or malformed JSON.
29 #[error("error-encoding-3 JSON deserialization failed: {0:?}")]
30 JsonDeserializationFailed(serde_json::Error),
31}