Struct envelope::ErrorBody
zaun_community_protocol::envelope::ErrorBody · Struct
pub struct ErrorBody { … }An error object: code, message, and the code’s extra fields placed next to code. Build it with the constructors (one per ErrorCode, see errors.rs); they
use fixed messages so no secret, connection detail, member key or other member’s data can
reach the wire. The extras are boxed to keep Result<_, ErrorBody> small.
Fields
Section titled “Fields”code: ErrorCode
Section titled “code: ErrorCode”What went wrong; clients branch on this only.
message: String
Section titled “message: String”Human-readable English text; informative, never branched on.
extras: Box<ErrorExtras>
Section titled “extras: Box<ErrorExtras>”The code’s extra fields, serialised next to code (absent ones are omitted).
Methods
Section titled “Methods”bad_request
Section titled “bad_request”pub fn bad_request(field: Option<&str>) -> SelfBAD_REQUEST, naming the offending field path when known ("body.content"). The
path names a schema field; never put a received value in it.
payload_too_large
Section titled “payload_too_large”pub fn payload_too_large(limit: u64) -> SelfPAYLOAD_TOO_LARGE with the limit exceeded, in bytes or items.
unsupported_version
Section titled “unsupported_version”pub fn unsupported_version(supported: VersionRange) -> SelfUNSUPPORTED_VERSION with the host’s supported range.
unsupported_feature
Section titled “unsupported_feature”pub fn unsupported_feature<impl Into<Cow<'static, str>>>(feature: impl Into<Cow<'static, str>>) -> SelfUNSUPPORTED_FEATURE naming the feature ("attachments", "voice", a reserved
command name). The name may be dynamic (BodyError::UnsupportedFeature) but must be a
protocol name, never text taken from a secret or another member.
forbidden
Section titled “forbidden”pub fn forbidden(missing: Option<u64>, reason: Option<Reason>) -> SelfFORBIDDEN, with the missing permission bits and the cause when known.
suspended
Section titled “suspended”pub fn suspended(until: Option<u64>) -> SelfSUSPENDED, with the end of the suspension when it has one.
conflict
Section titled “conflict”pub fn conflict(reason: Reason) -> SelfCONFLICT with its reason.
invalid_signature
Section titled “invalid_signature”pub fn invalid_signature(object: &'static str) -> SelfINVALID_SIGNATURE naming the signed object ("descriptor", "delegation", …).
slowmode_active
Section titled “slowmode_active”pub fn slowmode_active(retry_after_ms: u64) -> SelfSLOWMODE_ACTIVE (message as in the the protocol example).
rate_limited
Section titled “rate_limited”pub fn rate_limited(retry_after_ms: u64, scope: RateScope, category: Option<RateCategory>) -> SelfRATE_LIMITED with the scope and, when one applies, the category.
timed_out
Section titled “timed_out”pub fn timed_out(until: u64) -> SelfTIMED_OUT until the given time.
pub fn busy(retry_after_ms: u64) -> SelfBUSY: the host’s bounded queues are full.
resync_required_member
Section titled “resync_required_member”pub fn resync_required_member() -> SelfRESYNC_REQUIRED for the member stream.
resync_required_channel
Section titled “resync_required_channel”pub fn resync_required_channel(channel_id: ChannelId) -> SelfRESYNC_REQUIRED for a channel stream.
pub fn new(code: ErrorCode, message: &'static str) -> SelfA body with only code and message.
with_message
Section titled “with_message”pub fn with_message(self, message: &'static str) -> SelfReplaces the default message with another fixed one.
is_recorded
Section titled “is_recorded”pub const fn is_recorded(&self) -> boolWhether a response carrying this error is stored as the idempotency record.
unsupported_command
Section titled “unsupported_command”pub fn unsupported_command() -> SelfUNSUPPORTED_COMMAND: unknown type.
hello_required
Section titled “hello_required”pub fn hello_required() -> SelfHELLO_REQUIRED: a command before a successful session.hello.
not_bound
Section titled “not_bound”pub fn not_bound() -> SelfNOT_BOUND: a bound-only command on an unbound connection.
wrong_community
Section titled “wrong_community”pub fn wrong_community() -> SelfWRONG_COMMUNITY: community_id differs from the binding.
host_not_authorized
Section titled “host_not_authorized”pub fn host_not_authorized() -> SelfHOST_NOT_AUTHORIZED: no valid delegation for the community.
pending_approval
Section titled “pending_approval”pub fn pending_approval() -> SelfPENDING_APPROVAL: the member is pending.
admission_closed
Section titled “admission_closed”pub fn admission_closed() -> SelfADMISSION_CLOSED (one code for every cause, so it is not an oracle).
not_found
Section titled “not_found”pub fn not_found() -> SelfNOT_FOUND (missing and invisible are indistinguishable).
invite_invalid
Section titled “invite_invalid”pub fn invite_invalid() -> SelfINVITE_INVALID (one code for every cause, so it is not an oracle).
banned
Section titled “banned”pub fn banned() -> SelfBANNED: sent once, then the session ends.
internal
Section titled “internal”pub fn internal() -> SelfINTERNAL: details are logged on the host, never sent.
Trait implementations
Section titled “Trait implementations”Clone, Debug, Deserialize<'de>, Eq, PartialEq, Serialize, StructuralPartialEq