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

remove exceptions #23

Open
wants to merge 14 commits into
base: kp/job-manager
Choose a base branch
from
Open

remove exceptions #23

wants to merge 14 commits into from

Conversation

koonpeng
Copy link
Member

@koonpeng koonpeng commented Nov 9, 2023

This is a preview of the work in removing exceptions.

Inspired from rust, Result<T> is the alternative to exceptions. Internally it uses std::variant to store either the result or a std::exception.

  • [[nodiscard]] should almost always be used when returning Result<T>. We don't have custom lint rules so it will have to be checked manually.
  • Result<void> is a special case that using std::optional instead.
  • One downside is that we cannot return a reference, Result<T&> does not work because std::variant cannot contain references.
    • In theory should be able to specialize Result<T> for all reference types and store a pointer internally instead.

Teo Koon Peng added 4 commits November 8, 2023 11:18
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
@koonpeng koonpeng marked this pull request as draft November 9, 2023 07:55
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
@koonpeng koonpeng changed the base branch from main to kp/job-manager November 9, 2023 08:20
Teo Koon Peng added 4 commits November 14, 2023 16:09
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
@koonpeng koonpeng changed the title WIP remove exceptions remove exceptions Nov 20, 2023
@koonpeng koonpeng marked this pull request as ready for review November 20, 2023 02:56
Teo Koon Peng added 3 commits November 20, 2023 13:17
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
@koonpeng
Copy link
Member Author

Integration test is working with the latest release of ros2 iron, but the docker images are not updated yet.

@Yadunund
Copy link
Member

Yadunund commented Dec 4, 2023

Could you merge the latest main into the base branch also rebase/update this branch?

Teo Koon Peng and others added 2 commits December 5, 2023 10:22
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.

2 participants