mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-11-01 07:32:13 +01:00
adding error event with error code
This commit is contained in:
@@ -993,6 +993,13 @@ static void esp_mqtt_task(void *pv)
|
||||
client->config->port,
|
||||
client->config->network_timeout_ms) < 0) {
|
||||
ESP_LOGE(TAG, "Error transport connect");
|
||||
client->event.event_id = MQTT_EVENT_ERROR;
|
||||
#ifdef MQTT_SUPPORTED_FEATURE_TRANSPORT_ERR_REPORTING
|
||||
client->event.last_err = get_and_clear_last_error(client->transport);
|
||||
#else
|
||||
client->event.last_err = ESP_FAIL; // In case reporting not supported, only report general error
|
||||
#endif
|
||||
esp_mqtt_dispatch_event_with_msgid(client);
|
||||
esp_mqtt_abort_connection(client);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user