#[non_exhaustive]pub enum FrameError {
NotAnArray,
WrongArity {
message_type: MessageTypeId,
found: usize,
expected: usize,
},
UnknownMessageType {
number: String,
},
MessageTypeNotInVersion {
message_type: MessageTypeId,
version: Version,
},
UnreadableMessageId {
message_type: MessageTypeId,
},
UnreadableAction {
id: MessageId,
},
UnreadableErrorCode {
id: MessageId,
},
}Expand description
Why a text frame could not be turned into a Frame.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotAnArray
Not valid JSON, or not a JSON array with a numeric message type first.
WrongArity
The array has fewer elements than the message type requires.
Fields
message_type: MessageTypeIdThe message type that was read.
UnknownMessageType
A message type number outside 2–6.
Ignored on every version: 1.6J §4.1.3, 2.x Part 4 §4.1.
MessageTypeNotInVersion
A message type that exists in OCPP but not in the negotiated version
(CALLRESULTERROR and SEND before 2.1).
Fields
message_type: MessageTypeIdThe message type that was read.
UnreadableMessageId
The MessageId element is missing, empty, or not a JSON string.
2.x answers with id "-1" (Part 4 §4.1.1); the message type decides which answer,
so it is kept even though the id could not be read.
Fields
message_type: MessageTypeIdThe message type that was read.
UnreadableAction
The action element is not a JSON string.
UnreadableErrorCode
The error-code element is not a JSON string.
Implementations§
Source§impl FrameError
impl FrameError
Sourcepub fn message_type(&self) -> Option<MessageTypeId>
pub fn message_type(&self) -> Option<MessageTypeId>
The message type of the frame that failed to parse, when it got far enough to be read.
Sourcepub fn reply(&self, version: Version) -> FrameReply
pub fn reply(&self, version: Version) -> FrameReply
What the receiver must send back, per Part 4 §4.2.3.
Sourcepub fn is_ignorable(&self) -> bool
pub fn is_ignorable(&self) -> bool
Whether the specification says to silently ignore this frame rather than answer it.
True for a message type the version does not define, on every version: 1.6J §4.1.3 and 2.x Part 4 §4.1 (“it SHALL ignore the message”; 2.0.1 errata 2026-02 removed §4.4).
Sourcepub fn error_code(&self) -> ErrorCode
pub fn error_code(&self) -> ErrorCode
The CALLERROR code to answer with, if the frame must be answered at all.
Trait Implementations§
Source§impl Clone for FrameError
impl Clone for FrameError
Source§impl Debug for FrameError
impl Debug for FrameError
Source§impl Display for FrameError
impl Display for FrameError
impl Eq for FrameError
Source§impl Error for FrameError
Available on crate feature std only.
impl Error for FrameError
std only.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()