Commit 9935c47d authored by Deepak Rangarajan's avatar Deepak Rangarajan
Browse files

better exception messages

parent 1bda9dbf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ public:
      B.begin_facet();
      if (!B.test_facet(face.begin(), face.end()))
        throw std::runtime_error(
            "Unable to create the polyhedron. Check input!");
            "Unable to create the polyhedron. test_facet failed. Check input!");

      for (const auto &p_index : face) {
        B.add_vertex_to_facet(p_index);
+6 −7
Original line number Diff line number Diff line
@@ -509,9 +509,8 @@ template <> struct action<cylinder> {
    if (curr_attr.count("r")) {
      // proper cylinder
      if (curr_attr.count("r1") || curr_attr.count("r2")) {
        std::cout << " ERROR: cannot specify both r and (r1 or r2); ambiguous "
                  << std::endl;
        throw std::runtime_error("Error parsing cylinder. Check input!");
        throw std::runtime_error(
            " ERROR: cannot specify both r and (r1 or r2); ambiguous ");
      }
      csg::Cylinder cyl;
      cyl.name = get_name(curr_attr);
@@ -590,8 +589,9 @@ template <> struct action<polygon> {

    std::vector<std::vector<double>> paths = {{}};
    if (std::holds_alternative<std::string>(curr_attr["paths"])) {
      if (std::get<std::string>(curr_attr["paths"]) != UNDEFINED_STR)
        throw std::runtime_error("Error parsing polygon. Check inputs!");
      auto paths_str = std::get<std::string>(curr_attr["paths"];
      if (paths_str != UNDEFINED_STR)
        throw std::runtime_error("Error parsing polygon. paths = " + paths_str + " not recognized" );
    } else {
      paths = std::get<std::vector<std::vector<double>>>(curr_attr["paths"]);
    }
@@ -739,8 +739,7 @@ std::shared_ptr<Tree> parse_csg(std::string str) {

  if (tree.top.objs.empty())
    throw std::runtime_error(
        "Error parsing. Empty object tree created!"); // Disallow empty .csg
                                                      // file
        "Error parsing. Empty csg file"); // Disallow empty .csg file

  return std::make_shared<Tree>(tree);
}