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

Add missing throws documentation to rosbag_cpp writer open() #1788 #1789

Open
wants to merge 3 commits into
base: rolling
Choose a base branch
from

Conversation

gDorndorf
Copy link

Document that open() may throw.

Document that open() may throw.

Signed-off-by: Georg Dorndorf <[email protected]>
@gDorndorf gDorndorf requested a review from a team as a code owner August 14, 2024 10:14
@gDorndorf gDorndorf requested review from emersonknapp and james-rms and removed request for a team August 14, 2024 10:14
rosbag2_cpp/include/rosbag2_cpp/writer.hpp Outdated Show resolved Hide resolved
Comment on lines 80 to 85
* \throws runtime_error if
* database directory already exists,
* failed to create database directory,
* no storage could be initialized,
* invalid bag splitting size given,
* max cache size less or equal 0 when snapshot mode is enabled.
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if we want to list the all possible exception here, but at least indent is needed as below.

Suggested change
* \throws runtime_error if
* database directory already exists,
* failed to create database directory,
* no storage could be initialized,
* invalid bag splitting size given,
* max cache size less or equal 0 when snapshot mode is enabled.
* \throws runtime_error if database directory already exists,
* failed to create database directory, no storage could be initialized,
* invalid bag splitting size given,
* max cache size less or equal 0 when snapshot mode is enabled.

Copy link
Author

Choose a reason for hiding this comment

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

I agree that introduces some maintenance hazard keeping doc and implementation in sync, but it could be practical to have it there.

I'd also be fine with just a hint at some general throw behavior here.
So I'd leave it up to any reviewer as I am not too familiar with the style use throughout the rest of the codebase.

gDorndorf and others added 2 commits August 19, 2024 09:50
Remove documentation of implementation specific throw behaviour

Co-authored-by: Tomoya Fujita <[email protected]>
Signed-off-by: Georg Dorndorf <[email protected]>
Fix documentation intendation

Co-authored-by: Tomoya Fujita <[email protected]>
Signed-off-by: Georg Dorndorf <[email protected]>
Copy link
Contributor

@MichaelOrlov MichaelOrlov left a comment

Choose a reason for hiding this comment

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

@gDorndorf Thanks for PR and attempt to make our Rosbag2 better.
However, in this particular case documenting about possible throwing exceptions is not trivial. Because this is an upper rosbag2_cpp layer API which is calling storage plugin API inside.
Each storage plugin may throw or not and what type of exceptions it throws and in what cases are implementation details for concrete storage plugin.

What we can do is make some notes that certain functions may throw if the underlying rosbag2_storage plugin API also throws.
Update: we can be more specific and refer to the concrete storage_plugin API interface.

@emersonknapp
Copy link
Collaborator

Possibly a better API would be a no-throw bool API instead of void. The Writer itself does not throw any exceptions from its own code, but it does have the ability to catch them when making unsafe calls to the implementations

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.

4 participants