+ in setPyObject() only use classes derived from Base::Exception
This commit is contained in:
parent
e811e09545
commit
6fde5d764b
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<DocumentObjectPy*>(*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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <stdexcept>
|
||||
#include <iostream>
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<GeometryPy*>(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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<ConstraintPy*>(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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user