pub enum MqttError {
Show 58 variants
Io(String),
InvalidTopicName(String),
InvalidTopicFilter(String),
InvalidClientId(String),
ConnectionError(String),
ConnectionRefused(ReasonCode),
ProtocolError(String),
MalformedPacket(String),
PacketTooLarge {
size: usize,
max: usize,
},
AuthenticationFailed,
NotAuthorized,
NotConnected,
AlreadyConnected,
Timeout,
SubscriptionFailed(ReasonCode),
SubscriptionDenied(SubAckReasonCode),
UnsubscriptionFailed(ReasonCode),
PublishFailed(ReasonCode),
PacketIdNotFound(u16),
PacketIdInUse(u16),
InvalidQoS(u8),
InvalidPacketType(u8),
InvalidReasonCode(u8),
InvalidPropertyId(u8),
DuplicatePropertyId(u8),
SessionExpired,
KeepAliveTimeout,
ServerShuttingDown,
ClientClosed,
ConnectionClosedByPeer,
MaxConnectTime,
TopicAliasInvalid(u16),
ReceiveMaximumExceeded,
WillRejected,
ImplementationSpecific(String),
UnsupportedProtocolVersion,
InvalidState(String),
ClientIdentifierNotValid,
BadUsernameOrPassword,
ServerUnavailable,
ServerBusy,
Banned,
BadAuthenticationMethod,
QuotaExceeded,
PayloadFormatInvalid,
RetainNotSupported,
QoSNotSupported,
UseAnotherServer,
ServerMoved,
SharedSubscriptionsNotSupported,
ConnectionRateExceeded,
SubscriptionIdentifiersNotSupported,
WildcardSubscriptionsNotSupported,
MessageTooLarge,
FlowControlExceeded,
PacketIdExhausted,
StringTooLong(usize),
Configuration(String),
}Variants§
Io(String)
InvalidTopicName(String)
InvalidTopicFilter(String)
InvalidClientId(String)
ConnectionError(String)
ConnectionRefused(ReasonCode)
ProtocolError(String)
MalformedPacket(String)
PacketTooLarge
AuthenticationFailed
NotAuthorized
NotConnected
AlreadyConnected
Timeout
SubscriptionFailed(ReasonCode)
SubscriptionDenied(SubAckReasonCode)
UnsubscriptionFailed(ReasonCode)
PublishFailed(ReasonCode)
PacketIdNotFound(u16)
PacketIdInUse(u16)
InvalidQoS(u8)
InvalidPacketType(u8)
InvalidReasonCode(u8)
InvalidPropertyId(u8)
DuplicatePropertyId(u8)
SessionExpired
KeepAliveTimeout
ServerShuttingDown
ClientClosed
ConnectionClosedByPeer
MaxConnectTime
TopicAliasInvalid(u16)
ReceiveMaximumExceeded
WillRejected
ImplementationSpecific(String)
UnsupportedProtocolVersion
InvalidState(String)
ClientIdentifierNotValid
BadUsernameOrPassword
ServerBusy
Banned
BadAuthenticationMethod
QuotaExceeded
PayloadFormatInvalid
RetainNotSupported
QoSNotSupported
UseAnotherServer
ServerMoved
ConnectionRateExceeded
SubscriptionIdentifiersNotSupported
WildcardSubscriptionsNotSupported
MessageTooLarge
FlowControlExceeded
PacketIdExhausted
StringTooLong(usize)
Configuration(String)
Implementations§
Source§impl MqttError
impl MqttError
Sourcepub fn classify(&self) -> Option<RecoverableError>
pub fn classify(&self) -> Option<RecoverableError>
Classify this error for the retry/backoff layer.
Returns Some(kind) when retrying the same operation after a delay can
succeed on its own (see RecoverableError), and None when it cannot.
None covers three distinct cases, all of which a blind backoff loop
would handle wrong:
- Precondition errors such as
MqttError::NotConnected. These are returned whenever there is no active connection, which covers both a dropped link and callingpublish/subscribebeforeconnector afterdisconnect. The remedy is re-establishing the connection, a state transition owned by the reconnect layer, not re-issuing the same packet. For aQoS1 publish that failed because the link dropped, the intended recovery is reconnect plus resend of unacked messages on the next session, not treating the rawNotConnectedas retryable here. - Caller/permanent errors such as authentication failures, bad credentials, authorization denials, and protocol errors. Retrying is futile until the caller changes the request or their configuration.
- Connection-limit signals carried in
MqttError::ConnectionErrorstrings (seeMqttError::is_aws_iot_connection_limit). These look like network resets but indicate the account/client limit was hit; immediate retry makes it worse, so they are excluded on purpose.
This is intentionally conservative: a variant only classifies as
recoverable when re-issuing the identical operation is the correct
response. Anything requiring a reconnect, a different request, or human
intervention returns None.
pub fn is_aws_iot_connection_limit(&self) -> bool
Trait Implementations§
Source§impl Error for MqttError
impl Error for MqttError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for MqttError
impl RefUnwindSafe for MqttError
impl Send for MqttError
impl Sync for MqttError
impl Unpin for MqttError
impl UnsafeUnpin for MqttError
impl UnwindSafe for MqttError
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
Mutably borrows from an owned value. Read more