pub enum BodyError {
BadRequest {
field: Option<String>,
detail: String,
},
UnsupportedCommand,
UnsupportedFeature {
feature: String,
},
PayloadTooLarge {
field: String,
limit: u64,
},
}Expand description
A body that cannot be accepted. Each variant maps to one error code of §11; the envelope
layer adds request_id, the message text and the extra fields.
SPEC: §11 lets an over-limit field be either BAD_REQUEST (“value out of range”) or
PAYLOAD_TOO_LARGE (“an envelope or field exceeds §12”). This crate applies one rule: a
text, byte string or list longer than a §12 maximum is BodyError::PayloadTooLarge;
every other violation (missing, ill-typed, below a minimum, numeric range, rule) is
BodyError::BadRequest.
Variants§
BadRequest
BAD_REQUEST{field?}: malformed, missing, ill-typed or out-of-range value.
Fields
UnsupportedCommand
UNSUPPORTED_COMMAND: unknown type, or a reserved namespace (§13).
UnsupportedFeature
UNSUPPORTED_FEATURE{feature}: a known name or value not implemented in v1 (§8.11).
PayloadTooLarge
PAYLOAD_TOO_LARGE{limit}: a field longer than its §12 maximum.
Implementations§
Trait Implementations§
impl Eq for BodyError
Source§impl Error for BodyError
impl Error for BodyError
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()