Skip to content

Conversation

renzenicolai
Copy link

@renzenicolai renzenicolai commented Sep 21, 2025

Description

This PR changes the behavior of the esp_hosted_init function to return an esp_err_t error code instead of crashing by asserting using the ESP_ERROR_CHECK macro.

Related

The macro ESP_ERROR_CHECK is used often in Espressif code, as a user I would like it a lot if the use of this macro and asserts in general could be limited to an absolute minimum. If a function signature suggests an error code gets returned on failure then please do so instead of crashing.

In this particular case I would like to implement a recovery procedure or show a proper error message to the user when the Espressif API returns an error code. The use of ESP_ERROR_CHECK makes this impossible.

Testing

Tested on our product consisting of an ESP32-P4 and ESP32-C6 connected using SDIO.


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Sep 21, 2025
@github-actions github-actions bot changed the title Return error code instead of crashing on failed initialization Return error code instead of crashing on failed initialization (EHM-106) Sep 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants