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

Make split size error clearer #428

Merged
merged 1 commit into from
Jun 3, 2020

Conversation

piraka9011
Copy link
Contributor

@piraka9011 piraka9011 commented Jun 3, 2020

Make the error for setting the split bag file size state the minimum bag file size.

Current error is:

terminating with uncaught exception of type std::invalid_argument:
Invalid bag splitting size given. Please provide a different value.

Signed-off-by: Anas Abou Allaban aabouallaban@pm.me

Signed-off-by: Anas Abou Allaban <aabouallaban@pm.me>
Copy link
Collaborator

@Karsten1987 Karsten1987 left a comment

Choose a reason for hiding this comment

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

looks good to me with green CI

@piraka9011
Copy link
Contributor Author

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@piraka9011
Copy link
Contributor Author

piraka9011 commented Jun 3, 2020

There's unrelated windows warnings https://ci.ros2.org/job/ci_windows/10918/msbuild/new/

'rclcpp::node_interfaces::NodeParametersInterface::set_on_parameters_set_callback': use add_on_set_parameters_callback(OnParametersSetCallbackType callback) instead (compiling source file C:\ci\ws\src\ros2\rclcpp\rclcpp\src\rclcpp\node.cpp)

I'll merge this if there's no objections (this is part of Foxy QA) @Karsten1987 @zmichaels11

throw std::invalid_argument{
"Invalid bag splitting size given. Please provide a different value."};
std::stringstream error;
error << "Invalid bag splitting size given. Please provide a value greater than " <<
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: do you want to add the size specified to the thrown message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think that makes sense since it's already known by the user.
The goal of this PR is to inform the user of a suitable alternative to what they provided beforehand.

throw std::runtime_error(
"Invalid bag splitting size given. Please provide a different value.");
std::stringstream error;
error << "Invalid bag splitting size given. Please provide a value greater than " <<
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: do you want to add the size specified to the thrown message?

@@ -154,7 +154,7 @@ TEST_F(SequentialWriterTest, open_throws_error_on_invalid_splitting_size) {
ON_CALL(*storage_, get_minimum_split_file_size()).WillByDefault(Return(min_split_file_size));
storage_options_.max_bagfile_size = max_bagfile_size;

EXPECT_CALL(*storage_, get_minimum_split_file_size).Times(1);
EXPECT_CALL(*storage_, get_minimum_split_file_size).Times(2);
Copy link
Contributor

@dabonnie dabonnie Jun 3, 2020

Choose a reason for hiding this comment

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

Don't you need a test with the EXPECT_THROW macro? Edit, nevermind expanding the code shows that case handled. Nit to expect the runtime_error thrown.

@piraka9011 piraka9011 merged commit d3e92d6 into ros2:master Jun 3, 2020
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.

None yet

4 participants