Skip to content

treewide: bluetooth: change error codes to nrf_error#437

Merged
eivindj-nordic merged 12 commits into
nrfconnect:mainfrom
eivindj-nordic:error_code_alignment_ble_conn_param
Nov 12, 2025
Merged

treewide: bluetooth: change error codes to nrf_error#437
eivindj-nordic merged 12 commits into
nrfconnect:mainfrom
eivindj-nordic:error_code_alignment_ble_conn_param

Conversation

@eivindj-nordic
Copy link
Copy Markdown
Contributor

@eivindj-nordic eivindj-nordic commented Oct 22, 2025

Change error codes to nrf_errors.
Moving forward all non-BLE libraries and components will return errnos, while BLE related code as BLE services, libraries and the SoftDevice will return nrf_errors.

@eivindj-nordic eivindj-nordic self-assigned this Oct 22, 2025
@eivindj-nordic eivindj-nordic requested review from a team as code owners October 22, 2025 07:38
@github-actions github-actions Bot added changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. doc-required PR must not be merged without tech writer approval. labels Oct 22, 2025
@eivindj-nordic eivindj-nordic changed the title lib: bluetooth: ble_conn_params: change error codes to nrf_error treewide: bluetooth: change error codes to nrf_error Oct 22, 2025
@github-actions
Copy link
Copy Markdown

You can find the documentation preview for this PR here.

@eivindj-nordic eivindj-nordic marked this pull request as draft October 22, 2025 07:40
@eivindj-nordic eivindj-nordic force-pushed the error_code_alignment_ble_conn_param branch 11 times, most recently from 965ce66 to 9081c8f Compare October 24, 2025 08:09
@eivindj-nordic eivindj-nordic added this to the v1.0.0 milestone Oct 24, 2025
@eivindj-nordic eivindj-nordic force-pushed the error_code_alignment_ble_conn_param branch 2 times, most recently from 15e31c8 to 54ac6bd Compare October 24, 2025 11:44
@eivindj-nordic eivindj-nordic marked this pull request as ready for review October 24, 2025 11:47
@eivindj-nordic eivindj-nordic force-pushed the error_code_alignment_ble_conn_param branch 5 times, most recently from ad2cee7 to fd60847 Compare October 24, 2025 13:25
@eivindj-nordic eivindj-nordic force-pushed the error_code_alignment_ble_conn_param branch 5 times, most recently from bcbaa25 to c12373f Compare November 3, 2025 11:47
Comment thread lib/bluetooth/peer_manager/modules/security_manager.c Outdated
Comment thread lib/bluetooth/ble_gq/gatt_queue.c Outdated
Comment thread doc/nrf-bm/release_notes/release_notes_changelog.rst Outdated
Comment thread doc/nrf-bm/release_notes/release_notes_changelog.rst Outdated
@eivindj-nordic eivindj-nordic force-pushed the error_code_alignment_ble_conn_param branch 2 times, most recently from 28b49c8 to 8e87716 Compare November 4, 2025 09:07
@eivindj-nordic
Copy link
Copy Markdown
Contributor Author

@nrfconnect/ncs-bm-test @nrfconnect/ncs-eris Please review.

@eivindj-nordic eivindj-nordic force-pushed the error_code_alignment_ble_conn_param branch 2 times, most recently from dfe6a1c to a38cb05 Compare November 10, 2025 08:14
Removed a compliance warning.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
@eivindj-nordic eivindj-nordic force-pushed the error_code_alignment_ble_conn_param branch from a38cb05 to 4fe822e Compare November 11, 2025 12:40
Rename nrf error variables from err to nrf_err.
Rename nrfx error variables to nrfx_err and use nrfx_err_t type.
Align success checks for nrf_errors.
Replace (nrf_err != NRF_SUCCESS) with (nrf_err).

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Change error codes to nrf_errors.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Change error codes to nrf_errors.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Change error codes to nrf_errors.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Change error codes to nrf_errors.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Change error codes to nrf_errors.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Change error codes to nrf_errors.
Cleanup of ble_dis header.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Change error codes to nrf_errors.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Change error codes to nrf_errors.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Change error codes to nrf_errors.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Change error codes to nrf_errors.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
@eivindj-nordic eivindj-nordic force-pushed the error_code_alignment_ble_conn_param branch from 4fe822e to c31ca29 Compare November 12, 2025 08:12
Comment on lines +262 to 287
switch (nrf_err) {
case NRF_SUCCESS:
{
return 0;
return NRF_SUCCESS;
}
case BLE_ERROR_INVALID_CONN_HANDLE:
{
return -ENOTCONN;
return NRF_ERROR_NOT_FOUND;
}
case NRF_ERROR_INVALID_STATE:
{
return -EPIPE;
return NRF_ERROR_INVALID_STATE;
}
case NRF_ERROR_RESOURCES:
{
return -EAGAIN;
return NRF_ERROR_RESOURCES;
}
case NRF_ERROR_NOT_FOUND:
{
return -EBADF;
return NRF_ERROR_NOT_FOUND;
}
default:
{
LOG_ERR("Failed to send MCUmgr data, nrf_error %#x", err);
return -EIO;
LOG_ERR("Failed to send MCUmgr data, nrf_error %#x", nrf_err);
return NRF_ERROR_INTERNAL;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can simplify this in a follow up PR

@eivindj-nordic eivindj-nordic merged commit 20addf4 into nrfconnect:main Nov 12, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. doc-required PR must not be merged without tech writer approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants