Enum Error
pub enum Error {
Show 36 variants
Failure,
PersistenceError,
Disconnected,
MaxMessagesInflight,
BadUtf8String,
NullParameter,
TopicNameTruncated,
BadStructure,
BadQos,
NoMoreMsgIds,
OperationIncomplete,
MaxBufferedMessages,
SslNotSupported,
BadProtocol,
BadMqttOption,
WrongMqttVersion,
ZeroLenWillTopic,
CommandIgnored,
MaxBufferedZero,
TcpConnectTimeout,
TcpConnectCompletionFailure,
TcpTlsConnectFailure,
SocketError(i32),
ConnectReturn(ConnectReturnCode),
ReceivedDisconnect(i32),
Publish(i32, Message),
ReasonCode(ReasonCode, Properties),
BadTopicFilter,
Io(Error),
Utf8(Utf8Error),
Nul(NulError),
MissingSslOptions,
Conversion,
Timeout,
General(&'static str),
GeneralString(String),
}Expand description
The errors from an MQTT operation.
Variants§
Failure
A generic error code indicating the failure of an MQTT client operation.
PersistenceError
Persistence error
Disconnected
The client is disconnected.
MaxMessagesInflight
The maximum number of messages allowed to be simultaneously in-flight has been reached.
BadUtf8String
An invalid UTF-8 string has been detected.
NullParameter
A NULL parameter has been supplied to the underlying C library when this is invalid.
TopicNameTruncated
The topic has been truncated (the topic string includes embedded NULL characters). String functions will not access the full topic. Use the topic length value to access the full topic.
BadStructure
A structure parameter passed down to the C library does not have the correct eyecatcher and version number.
BadQos
An invaid QoS value was used not 0, 1, or 2)
NoMoreMsgIds
All 64k MQTT message ID are currently in use
OperationIncomplete
The request is being discarded when not complete
MaxBufferedMessages
The limit on the maximum number of message buffers has been reached.
SslNotSupported
Attempting SSL connection using non-SSL version of library.
BadProtocol
A bad URL protocol/schema was requested/ Note that the TLS enabled prefixes (ssl, mqtts, wss) are only valid if the TLS version of the library is linked int the app.
BadMqttOption
Don’t use options for another version of MQTT
WrongMqttVersion
Call not applicable to the client’s version of MQTT
ZeroLenWillTopic
The LWT topic can not be zero length
CommandIgnored
Connect or disconnect command ignored because there is already a connect or disconnect command at the head of the list waiting to be processed. Use the onSuccess/onFailure callbacks to wait for the previous connect or disconnect command to be complete.
MaxBufferedZero
The max number of buffered messages can not be zero. The library needs at least one slot for the outbound message.
TcpConnectTimeout
The TCP connection timed out
TcpConnectCompletionFailure
The TCP connection failed to complete
TcpTlsConnectFailure
TCP/TLS connection failure
SocketError(i32)
A socket error occurred
ConnectReturn(ConnectReturnCode)
ReceivedDisconnect(i32)
Publish(i32, Message)
A synchronous error when publishing creating or queuing the message.
ReasonCode(ReasonCode, Properties)
An MQTT v5 error from a reason code. Any reason code >= 0x80 indicates an error.
BadTopicFilter
A bad topic filter
Io(Error)
An low-level I/O error
Utf8(Utf8Error)
An error parsing a UTF-8 string
Nul(NulError)
A string NUL error
MissingSslOptions
Missing SSL/TLS options
Conversion
Conversion error between types
Timeout
A timeout, particularly from a synchronous operation.
General(&'static str)
A general error with description
GeneralString(String)
A general error with description
Implementations§
§impl Error
impl Error
pub fn from_return_code(rc: i32) -> Error
pub fn from_return_code(rc: i32) -> Error
Create an error from a Paho C return code.
These should not be confused with Connect Return Codes (v3.x) or Reason Codes (v5), although the C lib is sometimes vague about which integer value it is returning.
pub fn from_connect_return_code(code: u8) -> Error
pub fn from_connect_return_code(code: u8) -> Error
Create an error from an MQTT v3 Connect Return Code
pub fn from_reason_code(code: u8, props: Properties) -> Error
pub fn from_reason_code(code: u8, props: Properties) -> Error
Create an error from an MQTT v5 Reason Code and properties
Trait Implementations§
§impl Error for Error
impl Error for Error
§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
§impl From<(i32, &str)> for Error
impl From<(i32, &str)> for Error
§fn from(_: (i32, &str)) -> Error
fn from(_: (i32, &str)) -> Error
Convert a Paho C return code w/ reason string to an Error.
The Paho C library passes up error description strings that are supposed to be for “additional” information, but they actually describe specific errors that should have been enumerated. This is somewhat of a hack to use the string to enumerate errors. These strings are pulled directly from the C sources, and could change.