Skip to main content

ErrorCode

Enum ErrorCode 

Source
#[non_exhaustive]
pub enum ErrorCode {
Show 41 variants TlvTruncated, TlvInvalidControl, TlvContainerMismatch, TlvWrongType, TlvInvalidUtf8, TlvInvalidTag, TlvDepthExceeded, TlvOutOfRange, TlvNotFound, TlvDuplicateTag, MessageTruncated, UnsupportedVersion, MessageReserved, DuplicateMessage, IntegrityCheckFailed, NoExchange, NoSession, MrpRetransmitExhausted, NoSpace, Busy, BufferTooSmall, InvalidArgument, InvalidState, AlreadyExists, InvalidAction, ReportWouldChunk, CertInvalid, CertPathInvalid, CertExpired, Unsupported, DerMalformed, AttestationFailed, CommissioningFailed, DnsTruncated, DnsMalformed, MessageTooLarge, BdxAborted, BtpMalformed, BtpSequence, BtpTimeout, Platform,
}
Expand description

What went wrong, locally.

The set is closed by this crate rather than by the specification, so it is #[non_exhaustive]: new codes appear as layers land, and a consumer matching exhaustively should not break for that.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

TlvTruncated

A TLV element ended before its declared length.

§

TlvInvalidControl

A control octet named a reserved element type or an illegal tag control.

§

TlvContainerMismatch

A container was not terminated by an end-of-container element, or one appeared where no container was open.

§

TlvWrongType

The element is not of the type the reader was asked for.

§

TlvInvalidUtf8

A UTF-8 string element held bytes that are not valid UTF-8.

§

TlvInvalidTag

A structure member was anonymous, an array member was tagged, or a tag repeated inside a structure — Core §A.5.

§

TlvDepthExceeded

Container nesting went deeper than the reader’s fixed depth budget.

§

TlvOutOfRange

The value does not fit the requested Rust type (a u64 read as u8, say).

§

TlvNotFound

A required element was absent.

§

TlvDuplicateTag

Two members of one structure carried the same tag — Core §A.5.1: “All member elements within a structure SHALL have a unique tag as compared to the other members”.

§

MessageTruncated

The message is shorter than its own header says it is.

§

UnsupportedVersion

The message header version is not one this node speaks — Core §4.4.1.1.

§

MessageReserved

A reserved DSIZ or session-type value — Core §4.4.1.1, §4.4.1.3.

§

DuplicateMessage

The message counter is outside the replay window, or repeats one already seen.

§

IntegrityCheckFailed

Decryption or the integrity check failed.

§

NoExchange

No exchange matches the message, and none could be created for it.

§

NoSession

No session matches the message’s session id.

§

MrpRetransmitExhausted

A reliable message was retransmitted MRP_MAX_TRANSMISSIONS times without an acknowledgement — Core §4.12.

§

NoSpace

A fixed-capacity table sized by Config is full.

§

Busy

The operation would block on a resource that is busy right now.

§

BufferTooSmall

A buffer given to this crate is too small for what was asked of it.

§

InvalidArgument

The argument is outside the range the specification allows.

§

InvalidState

The call is not legal in the current state.

§

AlreadyExists

The entry is already present and the operation does not replace it — the fabric conflict of §11.18’s AddNOC, for one.

§

InvalidAction

An interaction model action is malformed and must be answered with a StatusResponse carrying INVALID_ACTION rather than its usual response (Core §8.10).

This is an action-level refusal, distinct from the per-path Status a response carries: there is nothing well-formed enough to report a path for.

§

ReportWouldChunk

A report does not fit in one message and must be chunked — Core §10.2.3.

Not a failure so much as the wrong method: the read is perfectly servable, just not in a single message. Server::serve_chunk serves it as the series of messages §10.2.3 calls for. This exists so the one-message convenience can refuse rather than emit a MoreChunkedMessages it has no way to honour, which would leave the client waiting for a continuation that never comes.

§

CertInvalid

A Matter certificate violates one of the §6.5 encoding rules: an element out of order, a value out of range, a distinguished name the certificate’s type forbids.

§

CertPathInvalid

A certificate chain does not validate — a signature that does not verify, an issuer that does not match, a path longer than a path-len-constraint allows.

§

CertExpired

A certificate is being used outside its not-before/not-after window.

§

Unsupported

The operation is defined but this build does not implement it.

§

DerMalformed

A DER encoding is malformed: a truncated element, a length that is not in DER’s shortest form, or a structure that is not what its context requires.

§

AttestationFailed

§6.2.3’s Device Attestation Procedure did not pass: a signature that does not verify, a nonce the device did not echo back, or a chain that does not reach a trusted PAA.

§5.5 step 10 makes this a report, not a verdict — “the Commissioner MAY choose to either continue to the Commissioning, or terminate it, depending on implementation-dependent policies” — so it reaches the caller rather than ending the flow on its own.

§

CommissioningFailed

A commissioning command answered with an error: §11.10.5.1’s CommissioningErrorEnum or §11.18.5.1’s NodeOperationalCertStatusEnum, neither of which is OK.

§

DnsTruncated

A DNS message ended inside a name, a record, or a header.

§

DnsMalformed

A DNS message is malformed: a reserved label type, a compression pointer that does not point strictly backwards, a name with more labels than a Matter record has.

§

MessageTooLarge

A message on a stream transport announced a length past §4.15.2.3’s Maximum Message Size, or a length of zero.

Fatal to the connection either way. §4.5’s length prefix is the only message boundary a stream has, so a receiver that cannot hold the message has also lost its place: everything after it would be read as a header. §4.15.2.3 says to close, and tcp::too_large is the report to send first.

§

BdxAborted

A BDX transfer ended in failure, and the §11.22.3.2 status code said why.

This is the code for a caller that had to widen a bdx::StatusCode into the crate’s own error type; the bdx module’s own API keeps the status code, because it is what has to be sent back to the peer.

§

BtpMalformed

A BTP packet is malformed, or breaks one of §4.19.4.5’s reassembly rules: an Ending segment with no Beginning, a Beginning while another SDU is in flight, a reassembled length that does not match the Message Length it was promised.

Every one of these closes the BTP session. The protocol has no way to resynchronise, so continuing would mean reassembling two messages into one.

§

BtpSequence

A BTP sequence number did not increment by one, or an acknowledgement named a packet that was never sent or was already acknowledged — §4.19.4.6, §4.19.4.8. Also closes the session.

§

BtpTimeout

A BTP acknowledgement did not arrive within BTP_ACK_TIMEOUT (§4.19.4.8). The timer doubles as BTP’s keep-alive, so this is also how a peer notices a remote stack that has stopped answering.

§

Platform

The platform reported a failure.

Implementations§

Source§

impl ErrorCode

Source

pub const fn as_str(self) -> &'static str

A short, stable, human-readable name — the one that appears in logs.

Trait Implementations§

Source§

impl Clone for ErrorCode

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ErrorCode

Source§

impl Debug for ErrorCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ErrorCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ErrorCode

Source§

impl From<ErrorCode> for Error

Source§

fn from(code: ErrorCode) -> Self

Converts to this type from the input type.
Source§

impl Hash for ErrorCode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ErrorCode

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ErrorCode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.