#[non_exhaustive]pub enum BatchError {
Truncated {
len: usize,
need: usize,
},
UnsupportedVersion {
version: u8,
},
EmptyBatch,
TooManyRecords {
count: usize,
cap: usize,
},
EmptyRecord {
index: usize,
},
RecordTooLarge {
index: usize,
len: usize,
cap: usize,
},
TruncatedRecord {
index: usize,
},
LengthMismatch {
declared: usize,
actual: usize,
},
PaddingNotZero {
byte: u8,
},
}Expand description
Why a PushBatch body or AckBatch payload could not be decoded.
Variants name the conformance-vector tags, matching
CoordinateError’s convention so a non-Rust
implementer can map a rejection to the vector that pins it.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Truncated
Shorter than the fixed prefix every body has.
UnsupportedVersion
The leading version byte is one this build cannot parse.
EmptyBatch
record_count was zero. An empty batch is not a no-op to be tolerated:
it is a framing disagreement, because nothing legitimate produces one.
TooManyRecords
record_count exceeds the cap in force.
EmptyRecord
A record inside the batch declared a zero length. The WAB cannot
represent an empty record — a zero payload_len is its end-of-records
sentinel — so this is rejected here rather than deeper.
RecordTooLarge
A record inside the batch exceeds the per-record cap. Checked per record
and not only per frame, because the frame cap bounds the batch and an
operator who sets max_payload_bytes is bounding a record.
Fields
TruncatedRecord
An entry’s declared length runs past the end of the body.
LengthMismatch
The walk consumed a different number of bytes than the body holds, or
found a different number of records than record_count declared.
Both are the same class of fault: the two ends disagree about the layout. Using whichever half seems more plausible is how that disagreement turns into records silently dropped or invented.
PaddingNotZero
A padding bit in the final bitmap byte was set.
Rejected rather than ignored, following the ReservedFlagsSet
precedent: weir does not silently tolerate a set bit it has no meaning
for, because the next version might give it one.
Trait Implementations§
Source§impl Clone for BatchError
impl Clone for BatchError
Source§impl Debug for BatchError
impl Debug for BatchError
Source§impl Display for BatchError
impl Display for BatchError
impl Eq for BatchError
Source§impl Error for BatchError
impl Error for BatchError
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()