-
Notifications
You must be signed in to change notification settings - Fork 98
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
Adding Errors structure to XmlUtils #1296
Conversation
Signed-off-by: Marco A. Gutierrez <[email protected]>
Signed-off-by: Marco A. Gutierrez <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## sdf13 #1296 +/- ##
==========================================
- Coverage 87.58% 87.57% -0.01%
==========================================
Files 128 128
Lines 17095 17413 +318
==========================================
+ Hits 14972 15249 +277
- Misses 2123 2164 +41 ☔ View full report in Codecov by Sentry. |
include/sdf/Error.hh
Outdated
@@ -179,6 +179,12 @@ namespace sdf | |||
|
|||
/// \brief Generic error during parsing. | |||
PARSING_ERROR, | |||
|
|||
/// \brief File not found error. | |||
FILE_NOT_FOUND, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be FILE_NOT_FOUND_ERROR
to match the convention of the others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the interest of not changing enums as much as possible in stable versions, I'd say we should use the FILE_READ
error code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed in 2bc407d
src/XmlUtils.cc
Outdated
@@ -58,10 +74,21 @@ tinyxml2::XMLNode *DeepClone(tinyxml2::XMLDocument *_doc, | |||
|
|||
///////////////////////////////////////////////// | |||
std::string ElementToString(const tinyxml2::XMLElement *_elem) | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test to cover this method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -923,7 +923,8 @@ void Converter::Map(tinyxml2::XMLElement *_elem, | |||
///////////////////////////////////////////////// | |||
void Converter::Move(tinyxml2::XMLElement *_elem, | |||
tinyxml2::XMLElement *_moveElem, | |||
const bool _copy) | |||
const bool _copy, | |||
sdf::Errors &_errors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sdf::Errors
should be the first argument to be consistent with the rest of the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for whatever reason, the internal APIs in Converter.cc all have the sdf::Errors
as the last parameter. So the change in this PR is currently consistent with the rest of the private Converter
class APIbut not with the public API. If you want the Converter::Move
function to be changed, we can, but I wouldn't want to modify more of the Converter
class in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with maintaining consistency within a class. Let's leave it as is.
src/XmlUtils.cc
Outdated
} | ||
|
||
///////////////////////////////////////////////// | ||
std::string ElementToString(const tinyxml2::XMLElement *_elem, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sdf::Errors
should be the first argument to be consistent with the rest of the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/XmlUtils.hh
Outdated
@@ -29,7 +29,7 @@ namespace sdf | |||
// Inline bracket to help doxygen filtering. | |||
inline namespace SDF_VERSION_NAMESPACE { | |||
|
|||
/// \brief Perform a deep copy of an XML Node | |||
/// \brief Perform a deep copy f an XML Node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
I made a few more changes (see commit messages) and responded to all review comments except the request for tests. I'll come back to this later |
* Expect no errors in successful test * Expect XML_ERROR when passing nullptrs Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
@@ -923,7 +923,8 @@ void Converter::Map(tinyxml2::XMLElement *_elem, | |||
///////////////////////////////////////////////// | |||
void Converter::Move(tinyxml2::XMLElement *_elem, | |||
tinyxml2::XMLElement *_moveElem, | |||
const bool _copy) | |||
const bool _copy, | |||
sdf::Errors &_errors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with maintaining consistency within a class. Let's leave it as is.
🎉 New feature
Work towards #820.
Summary
Adds missing
sdf::Errors
structure as an option to report errors onXmlUitls
. Makes sure that no errors are printed and all are reported through the structure when using the functions that include it as parameter.Test it
Call the functions that report
sdf::Errors
through a parameter and no errors should be printed but only reported through the sdf structure.Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.