From 6fde5d764bec488b88d9c15eaf528067c0e51627 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 5 Jul 2013 15:29:04 +0200 Subject: [PATCH] + in setPyObject() only use classes derived from Base::Exception --- src/App/PropertyFile.cpp | 8 +-- src/App/PropertyGeo.cpp | 16 ++--- src/App/PropertyLinks.cpp | 12 ++-- src/App/PropertyStandard.cpp | 68 +++++++++---------- src/App/PropertyUnits.cpp | 4 +- src/Base/Exception.cpp | 68 +++++++++++++++++++ src/Base/Exception.h | 64 +++++++++++++++++ src/Mod/Fem/App/FemMeshProperty.cpp | 2 +- src/Mod/Mesh/App/MeshProperties.cpp | 4 +- src/Mod/Part/App/PropertyGeometryList.cpp | 4 +- src/Mod/Part/App/PropertyTopoShape.cpp | 2 +- src/Mod/Points/App/PropertyPointKernel.cpp | 2 +- src/Mod/Robot/App/PropertyTrajectory.cpp | 2 +- .../Sketcher/App/PropertyConstraintList.cpp | 4 +- 14 files changed, 196 insertions(+), 64 deletions(-) diff --git a/src/App/PropertyFile.cpp b/src/App/PropertyFile.cpp index 221ad82c3..5858d8e1e 100644 --- a/src/App/PropertyFile.cpp +++ b/src/App/PropertyFile.cpp @@ -260,7 +260,7 @@ void PropertyFileIncluded::setPyObject(PyObject *value) } else if (PyTuple_Check(value)) { if (PyTuple_Size(value) != 2) - throw Py::TypeError("Tuple needs size of (filePath,newFileName)"); + throw Base::TypeError("Tuple needs size of (filePath,newFileName)"); PyObject* file = PyTuple_GetItem(value,0); PyObject* name = PyTuple_GetItem(value,1); @@ -281,7 +281,7 @@ void PropertyFileIncluded::setPyObject(PyObject *value) else { std::string error = std::string("First item in tuple must be a file or string"); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } // decoding name @@ -296,7 +296,7 @@ void PropertyFileIncluded::setPyObject(PyObject *value) else { std::string error = std::string("Second item in tuple must be a string"); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } setValue(fileStr.c_str(),nameStr.c_str()); @@ -305,7 +305,7 @@ void PropertyFileIncluded::setPyObject(PyObject *value) else { std::string error = std::string("Type must be string or file"); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } // assign the string diff --git a/src/App/PropertyGeo.cpp b/src/App/PropertyGeo.cpp index 5a1adb114..47b718d67 100644 --- a/src/App/PropertyGeo.cpp +++ b/src/App/PropertyGeo.cpp @@ -117,7 +117,7 @@ void PropertyVector::setPyObject(PyObject *value) else if (PyInt_Check(item)) cVec.x = (float)PyInt_AsLong(item); else - throw Base::Exception("Not allowed type used in tuple (float expected)..."); + throw Base::TypeError("Not allowed type used in tuple (float expected)..."); // y item = PyTuple_GetItem(value,1); if (PyFloat_Check(item)) @@ -125,7 +125,7 @@ void PropertyVector::setPyObject(PyObject *value) else if (PyInt_Check(item)) cVec.y = (float)PyInt_AsLong(item); else - throw Base::Exception("Not allowed type used in tuple (float expected)..."); + throw Base::TypeError("Not allowed type used in tuple (float expected)..."); // z item = PyTuple_GetItem(value,2); if (PyFloat_Check(item)) @@ -133,13 +133,13 @@ void PropertyVector::setPyObject(PyObject *value) else if (PyInt_Check(item)) cVec.z = (float)PyInt_AsLong(item); else - throw Base::Exception("Not allowed type used in tuple (float expected)..."); + throw Base::TypeError("Not allowed type used in tuple (float expected)..."); setValue( cVec ); } else { std::string error = std::string("type must be 'Vector' or tuple of three floats, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -271,7 +271,7 @@ void PropertyVectorList::setPyObject(PyObject *value) else { std::string error = std::string("type must be 'Vector' or list of 'Vector', not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -396,7 +396,7 @@ void PropertyMatrix::setPyObject(PyObject *value) else if (PyInt_Check(item)) cMatrix[x][y] = (double)PyInt_AsLong(item); else - throw Base::Exception("Not allowed type used in matrix tuple (a number expected)..."); + throw Base::TypeError("Not allowed type used in matrix tuple (a number expected)..."); } } @@ -405,7 +405,7 @@ void PropertyMatrix::setPyObject(PyObject *value) else { std::string error = std::string("type must be 'Matrix' or tuple of 16 float or int, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -520,7 +520,7 @@ void PropertyPlacement::setPyObject(PyObject *value) else { std::string error = std::string("type must be 'Matrix' or 'Placement', not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } diff --git a/src/App/PropertyLinks.cpp b/src/App/PropertyLinks.cpp index bba19fcd1..7cc729aee 100644 --- a/src/App/PropertyLinks.cpp +++ b/src/App/PropertyLinks.cpp @@ -110,7 +110,7 @@ void PropertyLink::setPyObject(PyObject *value) else { std::string error = std::string("type must be 'DocumentObject' or 'NoneType', not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -257,7 +257,7 @@ void PropertyLinkSub::setPyObject(PyObject *value) else { std::string error = std::string("type of first element in tuple must be 'DocumentObject', not "); error += tup[0].ptr()->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } else if(Py_None == value) { @@ -266,7 +266,7 @@ void PropertyLinkSub::setPyObject(PyObject *value) else { std::string error = std::string("type must be 'DocumentObject', 'NoneType' or ('DocumentObject',['String',]) not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -409,7 +409,7 @@ void PropertyLinkList::setPyObject(PyObject *value) if (!PyObject_TypeCheck(*item, &(DocumentObjectPy::Type))) { std::string error = std::string("type in list must be 'DocumentObject', not "); error += (*item)->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } values[i] = static_cast(*item)->getDocumentObjectPtr(); @@ -424,7 +424,7 @@ void PropertyLinkList::setPyObject(PyObject *value) else { std::string error = std::string("type must be 'DocumentObject' or list of 'DocumentObject', not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -609,7 +609,7 @@ void PropertyLinkSubList::setPyObject(PyObject *value) else { std::string error = std::string("type must be 'DocumentObject' or list of 'DocumentObject', not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } diff --git a/src/App/PropertyStandard.cpp b/src/App/PropertyStandard.cpp index 4ec89060d..573538d6c 100644 --- a/src/App/PropertyStandard.cpp +++ b/src/App/PropertyStandard.cpp @@ -98,7 +98,7 @@ void PropertyInteger::setPyObject(PyObject *value) else { std::string error = std::string("type must be int, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -211,7 +211,7 @@ void PropertyPath::setPyObject(PyObject *value) else { std::string error = std::string("type must be str or unicode, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } // assign the path @@ -472,7 +472,7 @@ void PropertyEnumeration::setPyObject(PyObject *value) long i=0; while(*(plEnums++) != NULL)i++; if (val < 0 || i <= val) - throw Py::ValueError("Out of range"); + throw Base::ValueError("Out of range"); PropertyInteger::setValue(val); } } @@ -481,7 +481,7 @@ void PropertyEnumeration::setPyObject(PyObject *value) if (_EnumArray && isPartOf(str)) setValue(PyString_AsString (value)); else - throw Py::ValueError("not part of the enum"); + throw Base::ValueError("not part of the enum"); } else if (PyList_Check(value)) { Py_ssize_t nSize = PyList_Size(value); @@ -493,7 +493,7 @@ void PropertyEnumeration::setPyObject(PyObject *value) if (!PyString_Check(item)) { std::string error = std::string("type in list must be str, not "); error += item->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } values[i] = PyString_AsString(item); } @@ -505,7 +505,7 @@ void PropertyEnumeration::setPyObject(PyObject *value) else { std::string error = std::string("type must be int or str, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -582,7 +582,7 @@ void PropertyIntegerConstraint::setPyObject(PyObject *value) else { std::string error = std::string("type must be int, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -677,7 +677,7 @@ void PropertyIntegerList::setPyObject(PyObject *value) if (!PyInt_Check(item)) { std::string error = std::string("type in list must be int, not "); error += item->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } values[i] = PyInt_AsLong(item); } @@ -690,7 +690,7 @@ void PropertyIntegerList::setPyObject(PyObject *value) else { std::string error = std::string("type must be int or list of int, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -805,7 +805,7 @@ void PropertyIntegerSet::setPyObject(PyObject *value) if (!PyInt_Check(item)) { std::string error = std::string("type in list must be int, not "); error += item->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } values.insert(PyInt_AsLong(item)); } @@ -818,7 +818,7 @@ void PropertyIntegerSet::setPyObject(PyObject *value) else { std::string error = std::string("type must be int or list of int, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -928,7 +928,7 @@ void PropertyFloat::setPyObject(PyObject *value) else { std::string error = std::string("type must be float or int, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -1022,7 +1022,7 @@ void PropertyFloatConstraint::setPyObject(PyObject *value) else { std::string error = std::string("type must be float, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -1095,7 +1095,7 @@ void PropertyFloatList::setPyObject(PyObject *value) if (!PyFloat_Check(item)) { std::string error = std::string("type in list must be float, not "); error += item->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } values[i] = (float) PyFloat_AsDouble(item); @@ -1109,7 +1109,7 @@ void PropertyFloatList::setPyObject(PyObject *value) else { std::string error = std::string("type must be float or list of float, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -1240,7 +1240,7 @@ void PropertyString::setPyObject(PyObject *value) else { std::string error = std::string("type must be str or unicode, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } // assign the string @@ -1345,7 +1345,7 @@ void PropertyUUID::setPyObject(PyObject *value) else { std::string error = std::string("type must be a str, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } try { @@ -1355,7 +1355,7 @@ void PropertyUUID::setPyObject(PyObject *value) setValue(uid); } catch (const std::exception& e) { - throw Py::RuntimeError(e.what()); + throw Base::RuntimeError(e.what()); } } @@ -1495,7 +1495,7 @@ void PropertyStringList::setPyObject(PyObject *value) else { std::string error = std::string("type in list must be str or unicode, not "); error += item->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -1507,7 +1507,7 @@ void PropertyStringList::setPyObject(PyObject *value) else { std::string error = std::string("type must be str or list of str, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -1655,7 +1655,7 @@ void PropertyMap::setPyObject(PyObject *value) else { std::string error = std::string("type of the key need to be a string, not"); error += key->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } // check on the item: @@ -1671,7 +1671,7 @@ void PropertyMap::setPyObject(PyObject *value) else { std::string error = std::string("type in list must be string or unicode, not "); error += item->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -1680,7 +1680,7 @@ void PropertyMap::setPyObject(PyObject *value) else { std::string error = std::string("type must be a dict object"); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -1794,7 +1794,7 @@ void PropertyBool::setPyObject(PyObject *value) else { std::string error = std::string("type must be bool, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -1906,17 +1906,17 @@ void PropertyColor::setPyObject(PyObject *value) if (PyFloat_Check(item)) cCol.r = (float)PyFloat_AsDouble(item); else - throw Base::Exception("Type in tuple must be float"); + throw Base::TypeError("Type in tuple must be float"); item = PyTuple_GetItem(value,1); if (PyFloat_Check(item)) cCol.g = (float)PyFloat_AsDouble(item); else - throw Base::Exception("Type in tuple must be float"); + throw Base::TypeError("Type in tuple must be float"); item = PyTuple_GetItem(value,2); if (PyFloat_Check(item)) cCol.b = (float)PyFloat_AsDouble(item); else - throw Base::Exception("Type in tuple must be float"); + throw Base::TypeError("Type in tuple must be float"); } else if (PyTuple_Check(value) && PyTuple_Size(value) == 4) { PyObject* item; @@ -1924,22 +1924,22 @@ void PropertyColor::setPyObject(PyObject *value) if (PyFloat_Check(item)) cCol.r = (float)PyFloat_AsDouble(item); else - throw Base::Exception("Type in tuple must be float"); + throw Base::TypeError("Type in tuple must be float"); item = PyTuple_GetItem(value,1); if (PyFloat_Check(item)) cCol.g = (float)PyFloat_AsDouble(item); else - throw Base::Exception("Type in tuple must be float"); + throw Base::TypeError("Type in tuple must be float"); item = PyTuple_GetItem(value,2); if (PyFloat_Check(item)) cCol.b = (float)PyFloat_AsDouble(item); else - throw Base::Exception("Type in tuple must be float"); + throw Base::TypeError("Type in tuple must be float"); item = PyTuple_GetItem(value,3); if (PyFloat_Check(item)) cCol.a = (float)PyFloat_AsDouble(item); else - throw Base::Exception("Type in tuple must be float"); + throw Base::TypeError("Type in tuple must be float"); } else if (PyLong_Check(value)) { cCol.setPackedValue(PyLong_AsUnsignedLong(value)); @@ -1947,7 +1947,7 @@ void PropertyColor::setPyObject(PyObject *value) else { std::string error = std::string("type must be int or tuple of float, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } setValue( cCol ); @@ -2080,7 +2080,7 @@ void PropertyColorList::setPyObject(PyObject *value) else { std::string error = std::string("not allowed type, "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } @@ -2231,7 +2231,7 @@ void PropertyMaterial::setPyObject(PyObject *value) else { std::string error = std::string("type must be 'Material', not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } diff --git a/src/App/PropertyUnits.cpp b/src/App/PropertyUnits.cpp index fae1df405..e20f3e698 100644 --- a/src/App/PropertyUnits.cpp +++ b/src/App/PropertyUnits.cpp @@ -102,11 +102,11 @@ void PropertyLength::setPyObject(PyObject *value) else { std::string error = std::string("type must be float or int, not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } if (val < 0.0f) - throw Py::ValueError("value must be nonnegative"); + throw Base::ValueError("value must be nonnegative"); setValue(val); #endif diff --git a/src/Base/Exception.cpp b/src/Base/Exception.cpp index 4ca62890c..2d7b58c25 100644 --- a/src/Base/Exception.cpp +++ b/src/Base/Exception.cpp @@ -236,6 +236,74 @@ ProgramInformation::ProgramInformation(const ProgramInformation &inst) // --------------------------------------------------------- +TypeError::TypeError(const char * sMessage) + : Exception(sMessage) +{ +} + +TypeError::TypeError(const std::string& sMessage) + : Exception(sMessage) +{ +} + +TypeError::TypeError(const TypeError &inst) + : Exception(inst) +{ +} + +// --------------------------------------------------------- + +ValueError::ValueError(const char * sMessage) + : Exception(sMessage) +{ +} + +ValueError::ValueError(const std::string& sMessage) + : Exception(sMessage) +{ +} + +ValueError::ValueError(const ValueError &inst) + : Exception(inst) +{ +} + +// --------------------------------------------------------- + +AttributeError::AttributeError(const char * sMessage) + : Exception(sMessage) +{ +} + +AttributeError::AttributeError(const std::string& sMessage) + : Exception(sMessage) +{ +} + +AttributeError::AttributeError(const AttributeError &inst) + : Exception(inst) +{ +} + +// --------------------------------------------------------- + +RuntimeError::RuntimeError(const char * sMessage) + : Exception(sMessage) +{ +} + +RuntimeError::RuntimeError(const std::string& sMessage) + : Exception(sMessage) +{ +} + +RuntimeError::RuntimeError(const RuntimeError &inst) + : Exception(inst) +{ +} + +// --------------------------------------------------------- + #if defined(__GNUC__) && defined (FC_OS_LINUX) #include #include diff --git a/src/Base/Exception.h b/src/Base/Exception.h index d2c4a1ecd..391cc443d 100644 --- a/src/Base/Exception.h +++ b/src/Base/Exception.h @@ -206,6 +206,70 @@ public: virtual ~ProgramInformation() throw() {} }; +/** + * The TypeError can be used to indicate the usage of a wrong type. + * @author Werner Mayer + */ +class BaseExport TypeError : public Exception +{ +public: + /// Construction + TypeError(const char * sMessage); + TypeError(const std::string& sMessage); + /// Construction + TypeError(const TypeError &inst); + /// Destruction + virtual ~TypeError() throw() {} +}; + +/** + * The ValueError can be used to indicate the usage of a wrong value. + * @author Werner Mayer + */ +class BaseExport ValueError : public Exception +{ +public: + /// Construction + ValueError(const char * sMessage); + ValueError(const std::string& sMessage); + /// Construction + ValueError(const ValueError &inst); + /// Destruction + virtual ~ValueError() throw() {} +}; + +/** + * The AttributeError can be used to indicate the usage of a wrong value. + * @author Werner Mayer + */ +class BaseExport AttributeError : public Exception +{ +public: + /// Construction + AttributeError(const char * sMessage); + AttributeError(const std::string& sMessage); + /// Construction + AttributeError(const AttributeError &inst); + /// Destruction + virtual ~AttributeError() throw() {} +}; + +/** + * The RuntimeError can be used to indicate an unknown exception at runtime. + * @author Werner Mayer + */ +class BaseExport RuntimeError : public Exception +{ +public: + /// Construction + RuntimeError(const char * sMessage); + RuntimeError(const std::string& sMessage); + /// Construction + RuntimeError(const RuntimeError &inst); + /// Destruction + virtual ~RuntimeError() throw() {} +}; + inline void Exception::setMessage(const char * sMessage) { diff --git a/src/Mod/Fem/App/FemMeshProperty.cpp b/src/Mod/Fem/App/FemMeshProperty.cpp index 10e01fa9f..022337471 100755 --- a/src/Mod/Fem/App/FemMeshProperty.cpp +++ b/src/Mod/Fem/App/FemMeshProperty.cpp @@ -113,7 +113,7 @@ void PropertyFemMesh::setPyObject(PyObject *value) else { std::string error = std::string("type must be 'FemMesh', not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } diff --git a/src/Mod/Mesh/App/MeshProperties.cpp b/src/Mod/Mesh/App/MeshProperties.cpp index 9e68cae10..552cf54bf 100644 --- a/src/Mod/Mesh/App/MeshProperties.cpp +++ b/src/Mod/Mesh/App/MeshProperties.cpp @@ -261,7 +261,7 @@ PyObject* PropertyCurvatureList::getPyObject(void) void PropertyCurvatureList::setPyObject(PyObject *value) { - throw Py::AttributeError(std::string("This attribute is read-only")); + throw Base::AttributeError(std::string("This attribute is read-only")); } App::Property *PropertyCurvatureList::Copy(void) const @@ -430,7 +430,7 @@ void PropertyMeshKernel::setPyObject(PyObject *value) else { std::string error = std::string("type must be 'Mesh', not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } diff --git a/src/Mod/Part/App/PropertyGeometryList.cpp b/src/Mod/Part/App/PropertyGeometryList.cpp index 947b2a91e..bf0583276 100644 --- a/src/Mod/Part/App/PropertyGeometryList.cpp +++ b/src/Mod/Part/App/PropertyGeometryList.cpp @@ -123,7 +123,7 @@ void PropertyGeometryList::setPyObject(PyObject *value) if (!PyObject_TypeCheck(item, &(GeometryPy::Type))) { std::string error = std::string("types in list must be 'Geometry', not "); error += item->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } values[i] = static_cast(item)->getGeometryPtr(); @@ -138,7 +138,7 @@ void PropertyGeometryList::setPyObject(PyObject *value) else { std::string error = std::string("type must be 'Geometry' or list of 'Geometry', not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } diff --git a/src/Mod/Part/App/PropertyTopoShape.cpp b/src/Mod/Part/App/PropertyTopoShape.cpp index 718e7fee9..7fddf8b01 100644 --- a/src/Mod/Part/App/PropertyTopoShape.cpp +++ b/src/Mod/Part/App/PropertyTopoShape.cpp @@ -200,7 +200,7 @@ void PropertyPartShape::setPyObject(PyObject *value) else { std::string error = std::string("type must be 'Shape', not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } diff --git a/src/Mod/Points/App/PropertyPointKernel.cpp b/src/Mod/Points/App/PropertyPointKernel.cpp index f0dcf9498..9134efd8d 100644 --- a/src/Mod/Points/App/PropertyPointKernel.cpp +++ b/src/Mod/Points/App/PropertyPointKernel.cpp @@ -99,7 +99,7 @@ void PropertyPointKernel::setPyObject(PyObject *value) else { std::string error = std::string("type must be 'Points', not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } diff --git a/src/Mod/Robot/App/PropertyTrajectory.cpp b/src/Mod/Robot/App/PropertyTrajectory.cpp index 4b449c462..8116f24fe 100644 --- a/src/Mod/Robot/App/PropertyTrajectory.cpp +++ b/src/Mod/Robot/App/PropertyTrajectory.cpp @@ -106,7 +106,7 @@ void PropertyTrajectory::setPyObject(PyObject *value) else { std::string error = std::string("type must be 'Trajectory', not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } } diff --git a/src/Mod/Sketcher/App/PropertyConstraintList.cpp b/src/Mod/Sketcher/App/PropertyConstraintList.cpp index 6638c0a6c..b5825809e 100644 --- a/src/Mod/Sketcher/App/PropertyConstraintList.cpp +++ b/src/Mod/Sketcher/App/PropertyConstraintList.cpp @@ -126,7 +126,7 @@ void PropertyConstraintList::setPyObject(PyObject *value) if (!PyObject_TypeCheck(item, &(ConstraintPy::Type))) { std::string error = std::string("types in list must be 'Constraint', not "); error += item->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } values[i] = static_cast(item)->getConstraintPtr(); @@ -141,7 +141,7 @@ void PropertyConstraintList::setPyObject(PyObject *value) else { std::string error = std::string("type must be 'Constraint' or list of 'Constraint', not "); error += value->ob_type->tp_name; - throw Py::TypeError(error); + throw Base::TypeError(error); } }