Skip to content

fix: add error handling to TrackerStateMachine::init()#68

Closed
gdellis wants to merge 3 commits into
mainfrom
fix/state-machine-init-err
Closed

fix: add error handling to TrackerStateMachine::init()#68
gdellis wants to merge 3 commits into
mainfrom
fix/state-machine-init-err

Conversation

@gdellis
Copy link
Copy Markdown
Owner

@gdellis gdellis commented Apr 19, 2026

Summary

Change init() return type from void to esp_err_t to signal success/failure.

Changes

  • state_machine.hpp: Change void init() to esp_err_t init()
  • state_machine.cpp: Return error if Config::init() fails, otherwise ESP_OK
  • main.cpp: Handle returned error from state_machine.init()

Closes #58

gdellis added 3 commits April 18, 2026 18:57
- Add static_assert to verify BLE struct sizes (17 bytes for BleLocationData, 18 for BleAlertData)
- Add [[nodiscard]] to all esp_err_t returning methods to catch ignored errors at compile time
- Fix state_machine.cpp to use ESP_ERROR_CHECK on ble_.send_alert() call

Closes #61, #62
Note in get_device_name() docstring that ESP_ERR_NVS_NOT_FOUND
returns default name silently (intentional design).

Closes #49
- Change init() return type from void to esp_err_t
- Return error if Config::init() fails
- Handle error in main.cpp by logging (state machine still continues in degraded mode)

The state machine holds references to components, so init failures
don't prevent the machine from running - we log and continue in
ERROR state if critical (Config) fails.

Closes #58
@gdellis
Copy link
Copy Markdown
Owner Author

gdellis commented Apr 19, 2026

This PR adds error handling to TrackerStateMachine::init() (issue #58). The changes have already been merged into main via other PRs that were merged earlier.

Closing as duplicate.

@gdellis gdellis closed this Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add error handling to TrackerStateMachine::init()

1 participant