PrevUpHomeNext

Error handling

The table below provides a reference of all async_mqtt5::error_code instances that asynchronous operations may complete with, along with the reasons for their occurrence.

Table 1.3. Error codes

Error code

Cause

boost::system::errc::errc_t::success

The operation completed successfully.

boost::asio::error::opreation_aborted

The operation has been cancelled. The cancellation of the operation can be triggered by invoking either mqtt_client::cancel or mqtt_client::async_disconnect. Furthermore, if a cancellation slot has been associated with the CompletionToken provided and the corresponding cancellation signal is emitted, the operation will also finish with this error code (see Per-Operation Cancellation).

boost::asio::no_recovery

An non-recoverable error occurred during the attempt by the mqtt_client to establish a connection with the Server. The cause of this error may be attributed to the connection related parameters used during the initialization of the mqtt_client.

async_mqtt5::client::error::malformed_packet

The Client has attempted to send a packet that does not conform to the specification. This issue can arise from improperly formed UTF-8 encoded strings. Additionally, this error can be caused by providing out-of-range values.

async_mqtt5::client::error::packet_too_large

The Client has attempted to send a packet larger than the Maximum Packet Size the Server is willing to process.

async_mqtt5::client::error::session_expired

The Client has established a successful connection with a Server, but either the session does not exist or has expired. In cases where the Client had previously set up subscriptions to Topics, these subscriptions are also expired. Therefore, the Client should re-subscribe. This error code is exclusive to completion handlers associated with mqtt_client::async_receive calls.

async_mqtt5::client::error::pid_overrun

This error code signifies that the Client was unable to allocate a Packet Identifier for the current operation due to the exhaustion of the available identifiers. This occurs when there are 65535 outgoing Packets awaiting their responses.

async_mqtt5::client::error::invalid_topic

The Client has attempted to perform an action (publish, subscribe or unsubscribe) on an invalid Topic. See Topic semantic and usage for information on properly formed Topics. This error code is exclusive to completion handlers associated with mqtt_client::async_publish, mqtt_client::async_subscribe, and mqtt_client::async_unsubscribe calls. In the case of mqtt_client::async_subscribe and mqtt_client::async_unsubscribe, this error code occurs if at least one Topic provided is malformed.

async_mqtt5::client::error::qos_not_supported

The Client has attempted to publish an Application Message with QoS higher than the Maximum QoS specified by the Server. The Server does not support this QoS (see Maximum QoS). This error code is exclusive to completion handlers associated with mqtt_client::async_publish calls.

async_mqtt5::client::error::retain_not_available

The Client has attempted to publish an Application Message with the RETAIN flag set to 1. However, the Server does not support retained messages (see Retain Available). This error code is exclusive to completion handlers associated with mqtt_client::async_publish calls.

async_mqtt5::client::error::topic_alias_maximum

The Client has attempted to publish an Application Message with the Topic Alias exceeding the Server's supported Topic Alias Maximum. Additionally, this error code will arise in instances when the Server does NOT support Topic Aliases, and the Client has attempted to use them. See Topic Alias Maximum. This error code is exclusive to completion handlers associated with mqtt_client::async_publish calls.

async_mqtt5::client::error::wildcard_subscription_not_available

The Client has attempted to subscribe to multiple Topics using Wildcard Character (+ and/or #). However, the Server does not support Wildcard Subscriptions. This error code is exclusive to completion handlers associated with mqtt_client::async_subscribe calls.

async_mqtt5::client::error::subscription_identifier_not_available

The Client has attempted to associate a subscription with a Subscription Identifier. However, the Server either does not support Subscription Identifiers or the Subscription Identifier provided is out of range (the Subscription Identifier can have a value of 1 to 268,435,455). This error code is exclusive to completion handlers associated with mqtt_client::async_subscribe calls.

async_mqtt5::client::error::shared_subscription_not_available

The Client has attempted to establish a Shared Subscription. However, the Server does not support Shared Subscriptions. This error code is exclusive to completion handlers associated with mqtt_client::async_subscribe calls.



PrevUpHomeNext