pub enum MqttError<'e> {
Show 15 variants
Network(ErrorKind),
Server,
Alloc,
AuthPacketReceived,
Disconnect {
reason: ReasonCode,
reason_string: Option<MqttString<'e>>,
server_reference: Option<MqttString<'e>>,
},
RecoveryRequired,
PacketIdentifierNotInFlight,
RepublishQoSNotMatching,
PacketIdentifierAwaitingPubcomp,
PacketMaximumLengthExceeded,
ServerMaximumPacketSizeExceeded,
InvalidTopicAlias,
SessionBuffer,
SendQuotaExceeded,
IllegalDisconnectSessionExpiryInterval,
}Expand description
The main error returned by crate::client::Client.
Distincts between unrecoverable and recoverable errors. Recoverability in this context refers to whether the current network connection can be used for further communication after the error has occured.
§Recovery
- For unrecoverable errors,
crate::client::Client::abortcan be called to send an optional DISCONNECT packet if allowed by specification. You can then try to recover the session by callingcrate::client::Client::connectagain without clean start. - For recoverable errors, follow the error-specific behaviour.
Variants§
Network(ErrorKind)
An underlying Read/Write method returned an error.
Unrecoverable error. crate::client::Client::abort should be called.
Server
The remote server did something the client does not understand / does not match the specification.
Unrecoverable error. crate::client::Client::abort should be called.
Alloc
A buffer provision by the crate::buffer::BufferProvider failed. Therefore a packet
could not be received correctly.
Unrecoverable error. crate::client::Client::abort should be called.
AuthPacketReceived
An AUTH packet header has been received by the client. AUTH packets are not supported by the client.
The client has scheduled a DISCONNECT packet with ReasonCode::ImplementationSpecificError.
The packet body has not been decoded.
Unrecoverable error. crate::client::Client::abort should be called.
Disconnect
The client could not connect to the broker or the broker has sent a DISCONNECT packet.
Unrecoverable error. crate::client::Client::abort should be called.
Fields
reason: ReasonCodeThe ReasonCode of the causing CONNACK or DISCONNECT packet. If the disconnection is caused
by a CONNACK packet, the reason code ss always erroneous.
reason_string: Option<MqttString<'e>>The reason string property of the causing CONNACK or DISCONNECT packet if the server included a reason string.
server_reference: Option<MqttString<'e>>The server reference property of the causing CONNACK or DISCONNCET packet if the server included a server reference. Identifies another server which can be used.
RecoveryRequired
Another unrecoverable error has been returned earlier. The underlying connection is in a state, in which it refuses/is not able to perform regular communication.
Unrecoverable error. crate::client::Client::abort should be called.
PacketIdentifierNotInFlight
A republish of a packet without an in flight entry was attempted.
Recoverable error. No action has been taken by the client.
RepublishQoSNotMatching
A republish of a packet with a quality of service that does not match the quality of service of the original publication was attempted.
Recoverable error. No action has been taken by the client.
PacketIdentifierAwaitingPubcomp
A republish of a packet whose corresponding PUBREL packet has already been sent was attempted. Sending the PUBLISH packet in this case would result in a protocol violation.
Recoverable error. No action has been taken by the client.
PacketMaximumLengthExceeded
A packet was too long to encode its length with the variable byte integer.
This can currently only be returned from crate::client::Client::publish or
crate::client::Client::republish.
Recoverable error. No action has been taken by the client.
ServerMaximumPacketSizeExceeded
A packet is too long and would exceed the servers maximum packet size.
Recoverable error. No action has been taken by the client.
InvalidTopicAlias
The value of a topic alias in an outgoing PUBLISH packet was 0 or greater than the server’s maximum allowed value. Sending this PUBLISH packet would raise a protocol error.
Recoverable error. No action has been taken by the client.
SessionBuffer
An action was rejected because an internal buffer used for tracking session state is full.
Recoverable error. Try again after a crate::client::event::Event has been emitted that indicates
that buffer might be free again.
Example:
crate::client::Client::subscribe returns this error. Wait until a
crate::client::event::Event::Suback is received.
This clears a spot in the subscribe packet identifiers.
SendQuotaExceeded
A publish now would exceed the server’s receive maximum and ultimately cause a protocol error.
Recoverable error. Try again after either crate::client::event::Event::PublishAcknowledged or
crate::client::event::Event::PublishComplete has been emitted that indicates that buffer might be
free again.
been emitted that indicates that buffer might be free again.
IllegalDisconnectSessionExpiryInterval
A disconnect now with the given session expiry interval would cause a protocol error.
A disconnection was attempted with a session expiry interval change where the session expiry interval in the
CONNECT packet was zero (crate::config::SessionExpiryInterval::EndOnDisconnect) and was
greater than zero (crate::config::SessionExpiryInterval::NeverEnd or
crate::config::SessionExpiryInterval::Seconds) in the DISCONNECT packet.
Recoverable error. Try disconnecting again without an session expiry interval or with a
session expiry interval of zero (crate::config::SessionExpiryInterval::EndOnDisconnect).