Enum command::BodyError
zaun_community_protocol::command::BodyError · Enum
pub enum BodyError { … }A body that cannot be accepted. Each variant maps to one error code of the protocol; the envelope
layer adds request_id, the message text and the extra fields.
SPEC: the protocol lets an over-limit field be either BAD_REQUEST (“value out of range”) or
PAYLOAD_TOO_LARGE (“an envelope or field exceeds the protocol”). This crate applies one rule: a
text, byte string or list longer than a the protocol maximum is BodyError::PayloadTooLarge;
every other violation (missing, ill-typed, below a minimum, numeric range, rule) is
BodyError::BadRequest.
Variants
Section titled “Variants”BadRequest { field, detail }
Section titled “BadRequest { field, detail }”BAD_REQUEST{field?}: malformed, missing, ill-typed or out-of-range value.
UnsupportedCommand
Section titled “UnsupportedCommand”UNSUPPORTED_COMMAND: unknown type, or a reserved namespace.
UnsupportedFeature { feature }
Section titled “UnsupportedFeature { feature }”UNSUPPORTED_FEATURE{feature}: a known name or value not implemented in v1.
PayloadTooLarge { field, limit }
Section titled “PayloadTooLarge { field, limit }”PAYLOAD_TOO_LARGE{limit}: a field longer than its the protocol maximum.
Methods
Section titled “Methods”pub const fn code(&self) -> ErrorCodeThe the protocol error code to answer with.
pub fn field(&self) -> Option<&str>The field at fault, when one is known.
pub fn bad<impl Into<String>>(field: &str, detail: impl Into<String>) -> SelfBAD_REQUEST blaming field.
too_large
Section titled “too_large”pub fn too_large(field: &str, limit: usize) -> SelfPAYLOAD_TOO_LARGE for field with limit.
unsupported
Section titled “unsupported”pub fn unsupported(feature: &str) -> SelfUNSUPPORTED_FEATURE for feature.
Trait implementations
Section titled “Trait implementations”Clone, Debug, Display, Eq, Error, PartialEq, StructuralPartialEq