Merged
Conversation
Contributor
Author
df0ba86 to
c8ff1f5
Compare
tfoote
reviewed
Aug 12, 2020
tf2/src/buffer_core.cpp
Outdated
| default: | ||
| CONSOLE_BRIDGE_logError("Unknown error code: %d", retval); | ||
| assert(0); | ||
| throw std::runtime_error("Unknown error code: " + std::to_string(static_cast<int>(retval))); |
Contributor
There was a problem hiding this comment.
This is specifically an assert not an exception as it's not something that can or should be hit without a coding error and then can be compiled out for production. And isn't something that's recoverable so the developers shouldn't be trying to catch it.
When this was ported it used a ROS_ASSERT before. And the equivalent functionality was proposed to be ported here but that was stopped because it was a port and not a reimplementation: ros2/rcutils#112
Contributor
Author
There was a problem hiding this comment.
All right. I've put this back to an assert. I don't think it is in the purview of a library to assert, but I can live without it for now for the rest of the cleanups.
c8ff1f5 to
847d768
Compare
This does a few things: 1. Removes commented out code. This code has been commented out for a decade, so I think it is safe to say nobody is using it. 2. Uses size_t everywhere we are calling vector.size() 3. Ensures all member variables are suffixed with _ 4. Removes asserts and replaces them with exceptions. 5. Gets rid of redundant branches for error cases and uses just one switch statement for all possible return values. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
847d768 to
593b9de
Compare
Contributor
Author
|
@ros-pull-request-builder retest this please |
Contributor
Author
tfoote
approved these changes
Sep 4, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This does a few things:
out for a decade, so I think it is safe to say nobody is
using it.
uses just one switch statement for all possible return values.
Signed-off-by: Chris Lalancette clalancette@openrobotics.org