Replace Base::Exception with appropriate subclass

This commit is contained in:
wmayer
2018-11-14 17:47:43 +01:00
parent d11bfed7c6
commit cda4c96fa8
7 changed files with 12 additions and 12 deletions

View File

@@ -155,7 +155,7 @@ void Command::setFromGCode (const std::string& str)
value = "";
mode = "argument";
} else {
throw Base::Exception("Badly formatted GCode command");
throw Base::BadFormatError("Badly formatted GCode command");
}
mode = "argument";
} else if (mode == "none") {
@@ -168,7 +168,7 @@ void Command::setFromGCode (const std::string& str)
key = "";
value = "";
} else {
throw Base::Exception("Badly formatted GCode argument");
throw Base::BadFormatError("Badly formatted GCode argument");
}
} else if (mode == "comment") {
value += str[i];
@@ -198,7 +198,7 @@ void Command::setFromGCode (const std::string& str)
Parameters[key] = val;
}
} else {
throw Base::Exception("Badly formatted GCode argument");
throw Base::BadFormatError("Badly formatted GCode argument");
}
}

View File

@@ -99,7 +99,7 @@ void Toolpath::insertCommand(const Command &Cmd, int pos)
Command *tmp = new Command(Cmd);
vpcCommands.insert(vpcCommands.begin()+pos,tmp);
} else {
throw Base::Exception("Index not in range");
throw Base::IndexError("Index not in range");
}
recalculate();
}
@@ -112,7 +112,7 @@ void Toolpath::deleteCommand(int pos)
} else if (pos <= static_cast<int>(vpcCommands.size())) {
vpcCommands.erase (vpcCommands.begin()+pos);
} else {
throw Base::Exception("Index not in range");
throw Base::IndexError("Index not in range");
}
recalculate();
}
@@ -282,7 +282,7 @@ void Toolpath::recalculate(void) // recalculates the path cache
}
}
} catch (KDL::Error &e) {
throw Base::Exception(e.Description());
throw Base::RuntimeError(e.Description());
}
#endif
}

View File

@@ -307,7 +307,7 @@ void Tooltable::deleteTool(int pos)
if (Tools.find(pos) != Tools.end()) {
Tools.erase(pos);
} else {
throw Base::Exception("Index not found");
throw Base::IndexError("Index not found");
}
}

View File

@@ -255,7 +255,7 @@ App::DocumentObjectExecReturn *Edge2TracObject::execute(void)
}
default:
throw Base::Exception("Unknown Edge type in Robot::Edge2TracObject::execute()");
throw Base::TypeError("Unknown Edge type in Robot::Edge2TracObject::execute()");
}

View File

@@ -154,7 +154,7 @@ void Robot6AxisPy::setTcp(Py::Object value)
}
else if (PyObject_TypeCheck(*value, &(Base::PlacementPy::Type))) {
if(! getRobot6AxisPtr()->setTo(*static_cast<Base::PlacementPy*>(*value)->getPlacementPtr()))
throw Base::Exception("Can not reach Point");
throw Base::RuntimeError("Can not reach Point");
}
else {
std::string error = std::string("type must be 'Matrix' or 'Placement', not ");

View File

@@ -228,7 +228,7 @@ void Trajectory::generateTrajectory(void)
}
}
catch (KDL::Error &e) {
throw Base::Exception(e.Description());
throw Base::RuntimeError(e.Description());
}
}

View File

@@ -176,7 +176,7 @@ Py::String WaypointPy::getType(void) const
else if(getWaypointPtr()->Type == Waypoint::UNDEF)
return Py::String("UNDEF");
else
throw Base::Exception("Unknown waypoint type! Only: PTP,LIN,CIRC,WAIT are supported.");
throw Base::TypeError("Unknown waypoint type! Only: PTP,LIN,CIRC,WAIT are supported.");
}
void WaypointPy::setType(Py::String arg)
@@ -191,7 +191,7 @@ void WaypointPy::setType(Py::String arg)
else if(typeStr=="WAIT")
getWaypointPtr()->Type = Waypoint::WAIT;
else
throw Base::Exception("Unknown waypoint type! Only: PTP,LIN,CIRC,WAIT are allowed.");
throw Base::TypeError("Unknown waypoint type! Only: PTP,LIN,CIRC,WAIT are allowed.");
}