Skip to content

Commit

Permalink
Use PINOCCHIO_THROW_PRETTY rather than plain exception
Browse files Browse the repository at this point in the history
  • Loading branch information
JafarAbdi committed Jan 2, 2025
1 parent aea0dfb commit 277fe70
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/parsers/mjcf/mjcf-graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,20 +600,23 @@ namespace pinocchio
auto vertex = el.get_optional<std::string>("<xmlattr>.vertex");
if (!vertex)
{
throw std::invalid_argument("Only meshes with files/vertices are supported");
PINOCCHIO_THROW_PRETTY(
std::invalid_argument, "Only meshes with files/vertices are supported.")
}

auto name = el.get_optional<std::string>("<xmlattr>.name");
if (!name)
{
throw std::invalid_argument("Mesh with vertices without a name is not supported");
PINOCCHIO_THROW_PRETTY(
std::invalid_argument, "Mesh with vertices without a name is not supported");
}

// Parse and validate vertices
Eigen::VectorXd meshVertices = internal::getUnknownSizeVectorFromStream(*vertex);
if (meshVertices.size() % 3 != 0)
{
throw std::invalid_argument("Number of vertices is not a multiple of 3");
PINOCCHIO_THROW_PRETTY(
std::invalid_argument, "Number of vertices is not a multiple of 3");
}

// Convert to 3D vertex matrix
Expand Down

0 comments on commit 277fe70

Please sign in to comment.