Py: replace BaseExceptionFreeCADError with more suitable exception types
This commit is contained in:
@@ -77,7 +77,7 @@ int AxisPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "empty parameter list, axis or base and direction expected");
|
||||
PyErr_SetString(PyExc_TypeError, "empty parameter list, axis or base and direction expected");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ const char* AbortException::what() const throw()
|
||||
|
||||
PyObject * AbortException::getPyExceptionType() const
|
||||
{
|
||||
return BaseExceptionFreeCADAbort;
|
||||
return PyExc_FC_FreeCADAbort;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
|
||||
@@ -112,7 +112,7 @@ void PyException::raiseException() {
|
||||
PP_PyDict_Object = nullptr;
|
||||
|
||||
std::string exceptionname;
|
||||
if (_exceptionType == Base::BaseExceptionFreeCADAbort)
|
||||
if (_exceptionType == Base::PyExc_FC_FreeCADAbort)
|
||||
edict.setItem("sclassname",
|
||||
Py::String(typeid(Base::AbortException).name()));
|
||||
if (_isReported)
|
||||
@@ -120,7 +120,7 @@ void PyException::raiseException() {
|
||||
Base::ExceptionFactory::Instance().raiseException(edict.ptr());
|
||||
}
|
||||
|
||||
if (_exceptionType == Base::BaseExceptionFreeCADAbort) {
|
||||
if (_exceptionType == Base::PyExc_FC_FreeCADAbort) {
|
||||
Base::AbortException e(_sErrMsg.c_str());
|
||||
e.setReported(_isReported);
|
||||
throw e;
|
||||
|
||||
@@ -120,7 +120,7 @@ int MatrixPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "matrix or up to 16 floats expected");
|
||||
PyErr_SetString(PyExc_TypeError, "matrix or up to 16 floats expected");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -610,7 +610,7 @@ PyObject* MatrixPy::multiply(PyObject * args)
|
||||
return new VectorPy(new Vector3d(vec));
|
||||
}
|
||||
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "either vector or matrix expected");
|
||||
PyErr_SetString(PyExc_TypeError, "either vector or matrix expected");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ int PlacementPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "empty parameter list, matrix or placement expected");
|
||||
PyErr_SetString(PyExc_TypeError, "empty parameter list, matrix or placement expected");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
using namespace Base;
|
||||
|
||||
PyObject* Base::BaseExceptionFreeCADError = nullptr;
|
||||
PyObject* Base::BaseExceptionFreeCADAbort = nullptr;
|
||||
PyObject* Base::PyExc_FC_FreeCADAbort = nullptr;
|
||||
PyObject* Base::PyExc_FC_XMLBaseException = nullptr;
|
||||
PyObject* Base::PyExc_FC_XMLParseException = nullptr;
|
||||
PyObject* Base::PyExc_FC_XMLAttributeError = nullptr;
|
||||
|
||||
@@ -414,7 +414,7 @@ BaseExport extern PyObject* BaseExceptionFreeCADError;
|
||||
#define PY_FCERROR (Base::BaseExceptionFreeCADError ? \
|
||||
BaseExceptionFreeCADError : PyExc_RuntimeError)
|
||||
|
||||
BaseExport extern PyObject* BaseExceptionFreeCADAbort;
|
||||
BaseExport extern PyObject* PyExc_FC_FreeCADAbort;
|
||||
BaseExport extern PyObject* PyExc_FC_XMLBaseException;
|
||||
BaseExport extern PyObject* PyExc_FC_XMLParseException;
|
||||
BaseExport extern PyObject* PyExc_FC_XMLAttributeError;
|
||||
|
||||
Reference in New Issue
Block a user