issue #1700 replace PyExc_Exception

This commit is contained in:
Sebastian Hoogen
2014-08-29 21:12:45 +02:00
committed by wmayer
parent 1bc2e5d430
commit d49528b27e
21 changed files with 64 additions and 64 deletions

View File

@@ -72,7 +72,7 @@ open(PyObject *self, PyObject *args)
}
}
else
Py_Error(PyExc_Exception,"Could not load image");
Py_Error(Base::BaseExceptionFreeCADError,"Could not load image");
// Displaying the image in a view.
// This ImageView object takes ownership of the pixel data (in 'pointImageTo') so we don't need to delete it here

View File

@@ -101,7 +101,7 @@ open(PyObject *self, PyObject *args)
// extract ending
if(file.extension() == "")
Py_Error(PyExc_Exception,"no file ending");
Py_Error(Base::BaseExceptionFreeCADError,"no file ending");
if(file.hasExtension("jt"))
{
@@ -140,7 +140,7 @@ open(PyObject *self, PyObject *args)
}
else
{
Py_Error(PyExc_Exception,"unknown file ending");
Py_Error(Base::BaseExceptionFreeCADError,"unknown file ending");
}
@@ -165,7 +165,7 @@ insert(PyObject *self, PyObject *args)
// extract ending
if(file.extension() == "")
Py_Error(PyExc_Exception,"no file ending");
Py_Error(Base::BaseExceptionFreeCADError,"no file ending");
if(file.hasExtension("jt") )
{
@@ -175,7 +175,7 @@ insert(PyObject *self, PyObject *args)
{
char szBuf[200];
snprintf(szBuf, 200, "Import called to the non-existing document '%s'", DocName);
Py_Error(PyExc_Exception,szBuf);
Py_Error(Base::BaseExceptionFreeCADError,szBuf);
}
readFile(Name,0);
@@ -211,13 +211,13 @@ insert(PyObject *self, PyObject *args)
}else{
clearData();
//Py_Error(PyExc_Exception,"No Mesh in file");
//Py_Error(Base::BaseExceptionFreeCADError,"No Mesh in file");
Base::Console().Warning("No Mesh in file: %s\n",Name);
}
}
else
{
Py_Error(PyExc_Exception,"unknown file ending");
Py_Error(Base::BaseExceptionFreeCADError,"unknown file ending");
}
} PY_CATCH;

View File

@@ -1252,14 +1252,14 @@ PyObject* MeshPy::collapseFacets(PyObject *args)
facets.push_back(iIdx);
}
else {
Py_Error(PyExc_Exception, "list of integers needed");
Py_Error(Base::BaseExceptionFreeCADError, "list of integers needed");
}
}
getMeshObjectPtr()->collapseFacets(facets);
}
else {
Py_Error(PyExc_Exception, "List of Integers needed");
Py_Error(Base::BaseExceptionFreeCADError, "List of Integers needed");
}
Py_Return;

View File

@@ -55,17 +55,17 @@ loftOnCurve(PyObject *self, PyObject *args)
std::vector<Base::Vector3f> poly;
if (!PyList_Check(pcListObj))
Py_Error(PyExc_Exception,"List of Tuble of three or two floats needed as second parameter!");
Py_Error(Base::BaseExceptionFreeCADError,"List of Tuble of three or two floats needed as second parameter!");
int nSize = PyList_Size(pcListObj);
for (int i=0; i<nSize;++i)
{
PyObject* item = PyList_GetItem(pcListObj, i);
if (!PyTuple_Check(item))
Py_Error(PyExc_Exception,"List of Tuble of three or two floats needed as second parameter!");
Py_Error(Base::BaseExceptionFreeCADError,"List of Tuble of three or two floats needed as second parameter!");
int nTSize = PyTuple_Size(item);
if(nTSize != 2 && nTSize != 3)
Py_Error(PyExc_Exception,"List of Tuble of three or two floats needed as second parameter!");
Py_Error(Base::BaseExceptionFreeCADError,"List of Tuble of three or two floats needed as second parameter!");
Base::Vector3f vec(0,0,0);
@@ -73,7 +73,7 @@ loftOnCurve(PyObject *self, PyObject *args)
{
PyObject* item2 = PyTuple_GetItem(item, l);
if (!PyFloat_Check(item2))
Py_Error(PyExc_Exception,"List of Tuble of three or two floats needed as second parameter!");
Py_Error(Base::BaseExceptionFreeCADError,"List of Tuble of three or two floats needed as second parameter!");
vec[l] = (float)PyFloat_AS_DOUBLE(item2);
}
poly.push_back(vec);

View File

@@ -153,7 +153,7 @@ static PyObject * open(PyObject *self, PyObject *args)
// extract ending
if (file.extension() == "")
Py_Error(PyExc_Exception,"no file ending");
Py_Error(Base::BaseExceptionFreeCADError,"no file ending");
if (file.hasExtension("stp") || file.hasExtension("step")) {
// create new document and add Import feature
@@ -186,7 +186,7 @@ static PyObject * open(PyObject *self, PyObject *args)
pcDoc->recompute();
}
catch (const Base::Exception& e) {
Py_Error(PyExc_Exception, e.what());
Py_Error(Base::BaseExceptionFreeCADError, e.what());
}
}
} PY_CATCH_OCC;
@@ -208,7 +208,7 @@ static PyObject * insert(PyObject *self, PyObject *args)
// extract ending
if (file.extension() == "")
Py_Error(PyExc_Exception,"no file ending");
Py_Error(Base::BaseExceptionFreeCADError,"no file ending");
App::Document *pcDoc = App::GetApplication().getDocument(DocName);
if (!pcDoc) {
pcDoc = App::GetApplication().newDocument(DocName);
@@ -241,7 +241,7 @@ static PyObject * insert(PyObject *self, PyObject *args)
pcDoc->recompute();
}
catch (const Base::Exception& e) {
Py_Error(PyExc_Exception, e.what());
Py_Error(Base::BaseExceptionFreeCADError, e.what());
}
}
} PY_CATCH_OCC;

View File

@@ -1763,7 +1763,7 @@ Py::String TopoShapePy::getShapeType(void) const
{
TopoDS_Shape sh = getTopoShapePtr()->_Shape;
if (sh.IsNull())
throw Py::Exception(PyExc_Exception, "cannot determine type of null shape");
throw Py::Exception(Base::BaseExceptionFreeCADError, "cannot determine type of null shape");
TopAbs_ShapeEnum type = sh.ShapeType();
std::string name;
switch (type)
@@ -1804,7 +1804,7 @@ Py::String TopoShapePy::getOrientation(void) const
{
TopoDS_Shape sh = getTopoShapePtr()->_Shape;
if (sh.IsNull())
throw Py::Exception(PyExc_Exception, "cannot determine orientation of null shape");
throw Py::Exception(Base::BaseExceptionFreeCADError, "cannot determine orientation of null shape");
TopAbs_Orientation type = sh.Orientation();
std::string name;
switch (type)
@@ -1830,7 +1830,7 @@ void TopoShapePy::setOrientation(Py::String arg)
{
TopoDS_Shape& sh = getTopoShapePtr()->_Shape;
if (sh.IsNull())
throw Py::Exception(PyExc_Exception, "cannot determine orientation of null shape");
throw Py::Exception(Base::BaseExceptionFreeCADError, "cannot determine orientation of null shape");
std::string name = (std::string)arg;
TopAbs_Orientation type;
if (name == "Forward") {

View File

@@ -62,7 +62,7 @@ open(PyObject *self, PyObject *args)
// extract ending
if (file.extension() == "")
Py_Error(PyExc_Exception,"no file ending");
Py_Error(Base::BaseExceptionFreeCADError,"no file ending");
if (file.hasExtension("asc")) {
// create new document and add Import feature
@@ -90,7 +90,7 @@ open(PyObject *self, PyObject *args)
}
#endif
else {
Py_Error(PyExc_Exception,"unknown file ending");
Py_Error(Base::BaseExceptionFreeCADError,"unknown file ending");
}
} PY_CATCH;
@@ -111,7 +111,7 @@ insert(PyObject *self, PyObject *args)
// extract ending
if (file.extension() == "")
Py_Error(PyExc_Exception,"no file ending");
Py_Error(Base::BaseExceptionFreeCADError,"no file ending");
if (file.hasExtension("asc")) {
// add Import feature
@@ -145,7 +145,7 @@ insert(PyObject *self, PyObject *args)
}
#endif
else {
Py_Error(PyExc_Exception,"unknown file ending");
Py_Error(Base::BaseExceptionFreeCADError,"unknown file ending");
}
} PY_CATCH;

View File

@@ -185,7 +185,7 @@ writeCameraFile(PyObject *self, PyObject *args)
for(int i=0;i<4;i++) {
// check the right size of the Tuple of floats
if(PyTuple_GET_SIZE(Arg[i]) != 3)
Py_Error(PyExc_Exception,"Wrong parameter format, four Tuple of three floats needed!");
Py_Error(Base::BaseExceptionFreeCADError,"Wrong parameter format, four Tuple of three floats needed!");
// go through the Tuple of floats
for(int l=0;l<3;l++) {
@@ -198,7 +198,7 @@ writeCameraFile(PyObject *self, PyObject *args)
else if (PyInt_Check(temp))
vecs[i][l] = (double) PyInt_AsLong(temp);
else
Py_Error(PyExc_Exception,"Wrong parameter format, four Tuple of three floats needed!");
Py_Error(Base::BaseExceptionFreeCADError,"Wrong parameter format, four Tuple of three floats needed!");
}
}

View File

@@ -112,7 +112,7 @@ PyObject* TrajectoryPy::insertWaypoints(PyObject * args)
return new TrajectoryPy(new Robot::Trajectory(*getTrajectoryPtr()));
}
Py_Error(PyExc_Exception, "Wrong parameters - waypoint or placement expected");
Py_Error(Base::BaseExceptionFreeCADError, "Wrong parameters - waypoint or placement expected");
}

View File

@@ -61,7 +61,7 @@ static PyObject * open(PyObject *self, PyObject *args)
// extract ending
if (file.extension() == "")
Py_Error(PyExc_Exception,"no file ending");
Py_Error(Base::BaseExceptionFreeCADError,"no file ending");
//if (file.hasExtension("igs") || file.hasExtension("iges")) {
// // create new document and add Import feature
@@ -71,7 +71,7 @@ static PyObject * open(PyObject *self, PyObject *args)
// pcDoc->recompute();
//}
// else {
Py_Error(PyExc_Exception,"unknown file ending");
Py_Error(Base::BaseExceptionFreeCADError,"unknown file ending");
//}
Py_Return;
@@ -91,7 +91,7 @@ static PyObject * insert(PyObject *self, PyObject *args)
// extract ending
if (file.extension() == "")
Py_Error(PyExc_Exception,"no file ending");
Py_Error(Base::BaseExceptionFreeCADError,"no file ending");
App::Document *pcDoc = App::GetApplication().getDocument(DocName);
if (!pcDoc) {
pcDoc = App::GetApplication().newDocument(DocName);
@@ -105,7 +105,7 @@ static PyObject * insert(PyObject *self, PyObject *args)
pcDoc->recompute();
}
else {
Py_Error(PyExc_Exception,"unknown file ending");
Py_Error(Base::BaseExceptionFreeCADError,"unknown file ending");
}
} PY_CATCH;