#[non_exhaustive]pub enum EnvelopeError {
Unsigned {
status: u16,
},
Unverified,
ContractUnsupported {
op: String,
},
Seal(CratestackError),
Open(CratestackError),
UnexpectedPayloadType {
got: String,
},
StreamsUnsupported,
}Expand description
A failure that belongs to the signed transport, not to the call.
A client that has an envelope never falls back to a plain call: every one
of these is an error, and none of them carries a decoded body. In
particular an answer that arrives without a seal is
Unsigned whatever its status, so a proxy that strips
the envelope, or a server that was never asked to sign, cannot turn a
Required client into a plain one.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Unsigned
The response was not a COSE message. Nothing in its body was read.
The layer’s own refusals (a wrong audience, a stale
iat, an unsupported media type, an oversized body) are always
unsigned (ADR 0006 D4), so a 401 here usually means the server did
not accept the request, not that a proxy tampered with the answer.
Unverified
The response is a COSE message that failed verification: a bad signature or tag, an unknown key, or an answer sealed for a different request, status, route or key. The reason is deliberately not reported (ADR 0006 §10).
ContractUnsupported
The server answered the unsigned 426 whose body code is
contract_unsupported (RPC) or CONTRACT_UNSUPPORTED (REST): it no
longer serves the wire shape this client has for op (a breaking
change to that op since this client was built), so the call was
refused before any key was looked up. The answer is unsigned, so
it is a hint and never proof: anyone on the path could send it, and a
caller should offer “update the app” for that feature, not treat the
server’s contract as known. Its body is read only for that code,
which is unauthenticated; a 426 with any other code is
Unsigned. Calls to other ops are unaffected. op
is "METHOD /template" on REST and the op id on RPC.
Seal(CratestackError)
Sealing the request failed: the signer (a keystore, a KMS) refused or failed, or the envelope was misconfigured. Nothing was sent.
Open(CratestackError)
Opening the response failed for a reason that is not the message’s: the key resolver’s backend is down.
UnexpectedPayloadType
The response was sealed under a payload type the call did not ask
for (its Cratestack-Payload-Type, absent meaning
application/cbor, is not among the types the request advertised).
The body was not opened, let alone decoded: a client never decodes a
type it did not request. got is what the server named, truncated.
StreamsUnsupported
Streams and subscriptions cannot be sealed yet (ADR 0006 P1); the call was refused locally instead of being sent in plain.
Implementations§
Trait Implementations§
Source§impl Debug for EnvelopeError
impl Debug for EnvelopeError
Source§impl Display for EnvelopeError
impl Display for EnvelopeError
Source§impl Error for EnvelopeError
impl Error for EnvelopeError
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()
Source§impl From<EnvelopeError> for ClientError
impl From<EnvelopeError> for ClientError
Source§fn from(source: EnvelopeError) -> Self
fn from(source: EnvelopeError) -> Self
Source§impl From<EnvelopeError> for RpcClientError
impl From<EnvelopeError> for RpcClientError
Source§fn from(source: EnvelopeError) -> Self
fn from(source: EnvelopeError) -> Self
Auto Trait Implementations§
impl Freeze for EnvelopeError
impl RefUnwindSafe for EnvelopeError
impl Send for EnvelopeError
impl Sync for EnvelopeError
impl Unpin for EnvelopeError
impl UnsafeUnpin for EnvelopeError
impl UnwindSafe for EnvelopeError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more