Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[utils] update SuccessOrExit for error tracking #1929

Merged
merged 2 commits into from
Jul 5, 2023

Conversation

wgtdkp
Copy link
Member

@wgtdkp wgtdkp commented Jul 3, 2023

This commit updates the SuccessOrExit macro to accept an action before goto "exit". It allows us to add a log when error happens. For example, we can write:

SuccessOrExit((error = writeDatasetToSettings()), otbrLogErr("Failed to write dataset to settings"));

So that we know exactly which step a method fails at.


This commit also prints the error/status code for macro SuccessOrDie.

This commit updates the `SuccessOrExit` macro to accept an action
before goto "exit". It allows us to add a log when error happens.
For example, we can write:

```
SuccessOrExit((error = writeDatasetToSettings()), otbrLogErr("Failed to
write dataset to settings"));
```

So that we know exactly which step a method fails at.

------

This commit also prints the error/status code for macro `SuccessOrDie`.
Copy link
Contributor

@zhanglongxia zhanglongxia left a comment

Choose a reason for hiding this comment

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

LGTM

It looks like the latest openwrt/sdk docker image has dramatic
changes that the openwrt CI tests can't build anymore. An
example failure can be found here: https://github.com/openthread/ot-br-posix/actions/runs/5443907241/jobs/9901033612
@wgtdkp wgtdkp requested a review from jwhui July 4, 2023 03:40
@wgtdkp
Copy link
Member Author

wgtdkp commented Jul 4, 2023

@jwhui When merging this PR, please merge the two commits separately. The second one is for fixing the broken openwrt CI tests

@jwhui jwhui merged commit 2a11b14 into openthread:main Jul 5, 2023
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants