Py: replace BaseExceptionFreeCADError with more suitable exception types

This commit is contained in:
wmayer
2022-03-17 13:54:23 +01:00
parent d84fd8a2df
commit d69defaa3c
38 changed files with 148 additions and 133 deletions

View File

@@ -197,24 +197,24 @@ private:
auto exText( "List of Tuples of three or two floats needed as second parameter!" );
if (!PyList_Check(pcListObj))
throw Py::Exception(Base::BaseExceptionFreeCADError, exText);
throw Py::TypeError(exText);
int nSize = PyList_Size(pcListObj);
for (int i=0; i<nSize;++i) {
PyObject* item = PyList_GetItem(pcListObj, i);
if (!PyTuple_Check(item))
throw Py::Exception(Base::BaseExceptionFreeCADError, exText);
throw Py::TypeError(exText);
int nTSize = PyTuple_Size(item);
if (nTSize != 2 && nTSize != 3)
throw Py::Exception(Base::BaseExceptionFreeCADError, exText);
throw Py::ValueError(exText);
Base::Vector3f vec(0,0,0);
for(int l = 0; l < nTSize;l++) {
PyObject* item2 = PyTuple_GetItem(item, l);
if (!PyFloat_Check(item2))
throw Py::Exception(Base::BaseExceptionFreeCADError, exText);
throw Py::TypeError(exText);
vec[l] = (float)PyFloat_AS_DOUBLE(item2);
}
poly.push_back(vec);
@@ -632,7 +632,7 @@ private:
return Py::asObject(new Mesh::MeshPy(mesher.createMesh()));
}
throw Py::Exception(Base::BaseExceptionFreeCADError,"Wrong arguments");
throw Py::TypeError("Wrong arguments");
}
};