pub enum DraftSpecificCause {
LocalRefusal,
PeerViolation {
rule: AboveCodecRule,
close: Option<u64>,
},
}Expand description
What one of a draft’s own ConnectionError variants is — the ones outside
the ten every draft shares.
Returned by Connection::draft_specific_cause, which every draft
implements exhaustively over its own error type. None from that function
means the variant is one of the shared ten, which
crate::dispatch::AnyConnectionError classifies itself and never asks a
draft about.
The split is the whole point: the two are opposite findings, one this build declining to do something and the other a relay having done something the draft forbids. Without it both reach a consumer as prose.
Variants§
LocalRefusal
This endpoint refused the call. Nothing was written and no state moved.
A message handed to the control stream that belongs on a request stream,
a respond_* helper pointed at a request this endpoint opened, a FIN
asked for before the response the draft requires first, an object asked
for before the header it is framed against. Every one of them is this
side being told to do something it will not do, and every one of them
reaches crate::dispatch::ErrorCause::Facade.
§And one that is not a call at all
ConnectionError::ControlMessageNarrowing is the odd member, and it is
here for the reason the rest are rather than because it looks like them.
Every draft’s recv_control decodes into AnyControlMessage and then
narrows the result to its own draft, and the arm that catches a
narrowing that did not work is unreachable: the decoder was this draft’s,
so the variant can only be this draft’s. Nothing pins that.
Spelled as CodecError::UnknownMessageType(0) the placeholder would not
stay inert. Every draft’s codec_session_error_code answers that
variant Some(PROTOCOL_VIOLATION), so an unreachable arm being reached
would reach a caller as the peer sent a control message type this
draft does not assign, and the session must be closed with a Protocol
Violation — with 0x00 riding along as the codepoint that proved it.
A conformance report reading that publishes a named accusation against a
relay, carrying a piece of evidence, for a defect in this build. Better
dressed than any accusation it makes on real grounds, and false.
So it is a variant of its own and it answers here. That does not make the arm reachable; it makes reaching it say this build declined rather than the peer violated, with no rule and no close code for anything downstream to read out of it.
PeerViolation
The peer broke a rule this endpoint enforces above its decoder.
Fields
rule: AboveCodecRuleWhich rule, named the same way on every draft that states it.
close: Option<u64>The session error code this draft’s own text requires be sent for it, where it names one.
Exactly the contract crate::dispatch::ErrorCause::Codec gives
close, and for the same reason: a rule a draft attaches no
consequence to is not grounds to name a peer.