Skip to content

Commit

Permalink
Small improvements to the error output in component parser to make de…
Browse files Browse the repository at this point in the history
…bugging easier. (#1580)

* Small improvements to the error output in component parser to make debugging easier.

* Correct formatting.
  • Loading branch information
destogl authored Jun 19, 2024
1 parent 01bc0f4 commit fbb893b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions hardware_interface/src/component_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,11 +797,13 @@ std::vector<HardwareInfo> parse_control_resources_from_urdf(const std::string &
tinyxml2::XMLDocument doc;
if (!doc.Parse(urdf.c_str()) && doc.Error())
{
throw std::runtime_error("invalid URDF passed in to robot parser");
throw std::runtime_error(
"invalid URDF passed in to robot parser: " + std::string(doc.ErrorStr()));
}
if (doc.Error())
{
throw std::runtime_error("invalid URDF passed in to robot parser");
throw std::runtime_error(
"invalid URDF passed in to robot parser: " + std::string(doc.ErrorStr()));
}

// Find robot tag
Expand Down Expand Up @@ -875,7 +877,7 @@ std::vector<HardwareInfo> parse_control_resources_from_urdf(const std::string &
auto urdf_joint = model.getJoint(joint.name);
if (!urdf_joint)
{
throw std::runtime_error("Joint " + joint.name + " not found in URDF");
throw std::runtime_error("Joint '" + joint.name + "' not found in URDF");
}
if (!urdf_joint->mimic && joint.is_mimic == MimicAttribute::TRUE)
{
Expand Down

0 comments on commit fbb893b

Please sign in to comment.