use specialized exception classes

This commit is contained in:
wmayer
2017-04-28 18:49:11 +02:00
parent 998c000516
commit fb7094bf31
60 changed files with 675 additions and 349 deletions

View File

@@ -213,7 +213,7 @@ PyObject *PropertyPath::getPyObject(void)
// Returns a new reference, don't increment it!
PyObject *p = PyUnicode_DecodeUTF8(str.c_str(),str.size(),0);
if (!p) throw Base::Exception("UTF8 conversion failure at PropertyPath::getPyObject()");
if (!p) throw Base::UnicodeError("UTF8 conversion failure at PropertyPath::getPyObject()");
return p;
}
@@ -1338,7 +1338,7 @@ const char* PropertyString::getValue(void) const
PyObject *PropertyString::getPyObject(void)
{
PyObject *p = PyUnicode_DecodeUTF8(_cValue.c_str(),_cValue.size(),0);
if (!p) throw Base::Exception("UTF8 conversion failure at PropertyString::getPyObject()");
if (!p) throw Base::UnicodeError("UTF8 conversion failure at PropertyString::getPyObject()");
return p;
}
@@ -1594,7 +1594,7 @@ PyObject *PropertyStringList::getPyObject(void)
PyObject* item = PyUnicode_DecodeUTF8(_lValueList[i].c_str(), _lValueList[i].size(), 0);
if (!item) {
Py_DECREF(list);
throw Base::Exception("UTF8 conversion failure at PropertyStringList::getPyObject()");
throw Base::UnicodeError("UTF8 conversion failure at PropertyStringList::getPyObject()");
}
PyList_SetItem(list, i, item);
}
@@ -1752,7 +1752,7 @@ PyObject *PropertyMap::getPyObject(void)
PyObject* item = PyUnicode_DecodeUTF8(it->second.c_str(), it->second.size(), 0);
if (!item) {
Py_DECREF(dict);
throw Base::Exception("UTF8 conversion failure at PropertyMap::getPyObject()");
throw Base::UnicodeError("UTF8 conversion failure at PropertyMap::getPyObject()");
}
PyDict_SetItemString(dict,it->first.c_str(),item);
}