ESP32 define custom esp_err_t errors and best practice
Posted: Thu Jan 09, 2020 1:10 pm
Hello all,
Is it possible to define custom esp_err_t types in addition to the existing esp errors?
I can see the definition of the esp error codes in some header files. It defines an error base + the unique error number as hex.
For instance in esp_ota_ops.h:
Is it possible to add my custom errors in my components header files in addition with the existing ones? If yes how to ensure that the error base does not exist and will not be in conflict by incoming ESP-IDF Updates?
If adding custom esp_err_t types is not possible what is the best practice to return ESP error codes and my own defined error codes from my functions?
Thanks
Is it possible to define custom esp_err_t types in addition to the existing esp errors?
I can see the definition of the esp error codes in some header files. It defines an error base + the unique error number as hex.
For instance in esp_ota_ops.h:
Code: Select all
#define ESP_ERR_OTA_BASE 0x1500 /*!< Base error code for ota_ops api */
#define ESP_ERR_OTA_PARTITION_CONFLICT (ESP_ERR_OTA_BASE + 0x01) /*!< Error if request was to write or erase the current running partition */
If adding custom esp_err_t types is not possible what is the best practice to return ESP error codes and my own defined error codes from my functions?
Thanks