Skip to content

enhancement: Add [[nodiscard]] to BLE error-returning methods #62

@gdellis

Description

@gdellis

Context

BleServer methods that return esp_err_t can have their return values ignored silently. If a caller forgets to check the error, failures go undetected.

Suggested Fix

Add [[nodiscard]] attribute to methods returning esp_err_t:

[[nodiscard]] esp_err_t init ();
[[nodiscard]] esp_err_t start ();
[[nodiscard]] esp_err_t stop ();
[[nodiscard]] esp_err_t update_location (const BleLocationData& location);
[[nodiscard]] esp_err_t send_alert (const BleAlertData& alert);
[[nodiscard]] esp_err_t set_device_name (const char* name);

This causes compiler warnings when return values are ignored.

Priority

Low - defensive coding improvement

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions