pub enum ErrorCode {
Show 19 variants
UnsupportedProtocolVersion,
MalformedFrame,
UnknownCommand,
FrameTooLarge,
PayloadTooLarge,
StaleRequest,
DuplicateRequest,
TooManyPending,
NotAuthorized,
DeviceOffline,
UnknownService,
ServiceActionFailed,
UnknownRun,
UnknownApproval,
ApprovalExpired,
Timeout,
RateLimited,
CapabilityUnavailable,
InternalError,
}Expand description
Why a frame was refused, or why the operation behind it did not happen.
Non-exhaustive is deliberate on the reading side only: a peer that meets a
code it does not know treats it as ErrorCode::InternalError rather than
failing to parse, so adding a code in a later minor revision cannot break an
older client. The serde representation below is what makes that work.
Variants§
UnsupportedProtocolVersion
The frame named a major version this peer cannot speak at all.
MalformedFrame
The bytes were not a valid envelope: bad JSON, missing field, unknown field, wrong type.
UnknownCommand
The envelope parsed, but type is not a name this peer accepts in
this direction. A response type arriving at the daemon is this, not
ErrorCode::MalformedFrame.
FrameTooLarge
The frame was larger than super::limits::MAX_FRAME_BYTES. Answered
only when the frame was small enough to identify; past that the socket
simply closes.
PayloadTooLarge
A field inside a well-formed frame exceeded its own limit — a prompt over 16 KiB, say.
StaleRequest
sentAt is outside the window in super::limits. The sender has
almost certainly stopped waiting.
DuplicateRequest
This request id was already seen inside the dedup window and the operation is not one that may run twice.
TooManyPending
The device already has super::limits::MAX_PENDING_COMMANDS requests
in flight.
NotAuthorized
The credential is revoked, belongs to another device, or the caller does not own this device.
DeviceOffline
No daemon socket is currently attached to this device. Never queued — presence fails closed.
UnknownService
No service by that exact name is registered. The remote surface never takes a pattern, so this is always an exact-name miss.
ServiceActionFailed
The daemon tried the action and it failed. The only code here that carries a message written by the local runtime rather than the protocol.
UnknownRun
No agent run by that id, or one that has already finished.
UnknownApproval
No pending approval by that id on that run.
ApprovalExpired
The approval was answered by its own expiry before the human answered it. Always a deny, never a silent drop.
Timeout
The operation was still running when its deadline passed. Not retryable: the daemon may yet finish it.
RateLimited
A per-IP, per-user or per-device rate limit refused the frame.
The peer speaks this protocol version but not this capability — an older daemon meeting a feature that shipped after it. Rendered to a user as “your machine needs updating”, never as a failure.
InternalError
Anything else, and anything a peer does not recognise.
Implementations§
Source§impl ErrorCode
impl ErrorCode
Sourcepub const ALL: &'static [Self]
pub const ALL: &'static [Self]
Every code, in wire order. The exhaustiveness tests and the generated documentation both read this, so a new variant that is not listed here fails the build’s own tests rather than shipping undocumented.
Sourcepub const fn retryable(self) -> bool
pub const fn retryable(self) -> bool
Whether the same request id may be sent again by an automatic retry.
True only where the operation provably did not start. Everything ambiguous — a timeout above all — is false, and is a decision for a human looking at the machine’s real state.
Sourcepub const fn fatal_to_session(self) -> bool
pub const fn fatal_to_session(self) -> bool
Whether meeting this code should close the device socket.
A daemon that cannot be trusted to frame correctly is not a daemon whose next frame should be believed.
Trait Implementations§
impl Copy for ErrorCode
Source§impl<'de> Deserialize<'de> for ErrorCode
impl<'de> Deserialize<'de> for ErrorCode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ErrorCode
Source§impl Ord for ErrorCode
impl Ord for ErrorCode
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for ErrorCode
impl PartialOrd for ErrorCode
impl StructuralPartialEq for ErrorCode
Auto Trait Implementations§
impl Freeze for ErrorCode
impl RefUnwindSafe for ErrorCode
impl Send for ErrorCode
impl Sync for ErrorCode
impl Unpin for ErrorCode
impl UnsafeUnpin for ErrorCode
impl UnwindSafe for ErrorCode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.