rustrade_integration/serde/de/error.rs
1/// Deserialisation error including the input payload.
2#[derive(Debug, thiserror::Error)]
3#[error("failed to deserialise binary payload ({} bytes): {kind}", payload.len())]
4pub struct DeBinaryError {
5 pub payload: Vec<u8>,
6 pub kind: DeBinaryErrorKind,
7}
8
9/// Deserialisation error kinds.
10#[derive(Debug, thiserror::Error)]
11pub enum DeBinaryErrorKind {
12 /// `serde_json` error.
13 #[error("serde deserialisation: {0}")]
14 Serde(#[from] serde_json::Error),
15
16 /// `prost` error.
17 #[error("protobuf deserialisation: {0}")]
18 Proto(#[from] prost::DecodeError),
19}