#[non_exhaustive]pub enum DecodeError {
TooLarge {
len: usize,
max: usize,
},
NotJson {
reason: String,
},
NoMessageType {
peek: Peek,
},
UnknownMessageType {
message_type: String,
peek: Peek,
},
NotInProfile {
kind: MessageKind,
profile: WireProfile,
peek: Peek,
},
Schema {
kind: MessageKind,
reason: String,
peek: Peek,
},
ProfileMismatch {
kind: MessageKind,
profile: WireProfile,
reason: String,
peek: Peek,
},
}Expand description
Why a message could not be decoded.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
TooLarge
Larger than DecodeOptions::max_bytes, and so never parsed.
NotJson
Not JSON at all, or not a JSON object.
NoMessageType
No message_type property, so there is no way to know what it is.
UnknownMessageType
A message_type this crate does not know.
NotInProfile
A message type that does not exist in the negotiated wire profile.
Fields
kind: MessageKindThe message.
profile: WireProfileThe profile that was being decoded against.
Schema
The message does not match the schema: a missing field, a wrong type, an unknown property in strict mode, or a value outside what the type can hold.
Fields
kind: MessageKindWhich message it claimed to be.
ProfileMismatch
A field the negotiated profile requires is absent, or one it forbids is present.
Implementations§
Source§impl DecodeError
impl DecodeError
Sourcepub fn status_value(&self) -> ReceptionStatusValues
pub fn status_value(&self) -> ReceptionStatusValues
The reception status the standard prescribes for this failure.
S2J schemas/ReceptionStatusValues draws the line precisely: INVALID_DATA is
“Message not understood (e.g. not valid JSON, no message_id found)” and
INVALID_MESSAGE is “Message was not according to schema”.
Sourcepub fn reception_status(&self) -> ReceptionStatus
pub fn reception_status(&self) -> ReceptionStatus
The complete ReceptionStatus to send back.
Trait Implementations§
Source§impl Clone for DecodeError
impl Clone for DecodeError
Source§fn clone(&self) -> DecodeError
fn clone(&self) -> DecodeError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DecodeError
impl Debug for DecodeError
Source§impl Display for DecodeError
impl Display for DecodeError
Source§impl Error for DecodeError
impl Error for DecodeError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()