Replace Base::Exception with appropriate subclass

This commit is contained in:
wmayer
2018-11-14 23:17:42 +01:00
parent e02695b91f
commit 7dc13bd2d6
4 changed files with 8 additions and 9 deletions

View File

@@ -111,10 +111,10 @@ DocumentObject* GeoFeatureGroupExtension::getGroupOfObject(const DocumentObject*
}
Base::Placement GeoFeatureGroupExtension::globalGroupPlacement() {
if(getExtendedObject()->isRecomputing())
throw Base::Exception("Global placement cannot be calculated on recompute");
throw Base::RuntimeError("Global placement cannot be calculated on recompute");
return recursiveGroupPlacement(this);
}
@@ -217,7 +217,7 @@ void GeoFeatureGroupExtension::extensionOnChanged(const Property* p) {
//if an error was found we need to correct the values and inform the user
if(error) {
Group.setValues(corrected);
throw Base::Exception("Object can only be in a single GeoFeatureGroup");
throw Base::RuntimeError("Object can only be in a single GeoFeatureGroup");
}
}
}

View File

@@ -186,7 +186,7 @@ bool GroupExtension::hasObject(const DocumentObject* obj, bool recursive) const
if (child == obj) {
return true;
} else if (child == getExtendedObject()) {
Base::Exception("Cyclic dependencies detected: Search cannot be performed");
Base::RuntimeError("Cyclic dependencies detected: Search cannot be performed");
} else if ( recursive && child->hasExtension(GroupExtension::getExtensionClassTypeId()) ) {
App::GroupExtension *subGroup = static_cast<App::GroupExtension *> (
@@ -227,7 +227,7 @@ bool GroupExtension::recursiveHasObject(const DocumentObject* obj, const GroupEx
auto ext = child->getExtensionByType<GroupExtension>();
if(std::find(history.begin(), history.end(), ext) != history.end())
Base::Exception("Cyclic dependencies detected: Search cannot be performed");
Base::RuntimeError("Cyclic dependencies detected: Search cannot be performed");
if (recursiveHasObject(obj, ext, history)) {
return true;
@@ -326,7 +326,7 @@ void GroupExtension::extensionOnChanged(const Property* p) {
//if an error was found we need to correct the values and inform the user
if(error) {
Group.setValues(corrected);
throw Base::Exception("Object can only be in a single Group");
throw Base::RuntimeError("Object can only be in a single Group");
}
}
}

View File

@@ -117,7 +117,6 @@ public:
virtual void setPyObject( PyObject * pydict);
protected:
public: // FIXME: Remove the public keyword
/* sMessage may be:
* - a UI compliant string susceptible to being translated and shown to the user in the UI
* - a very technical message not intended to be translated or shown to the user in the UI

View File

@@ -326,7 +326,7 @@ void InteractiveInterpreter::runCode(PyCodeObject* code) const
if (PyDict_Check(errdata)) {
PyObject* value = PyDict_GetItemString(errdata, "swhat");
if (value) {
Base::Exception e;
Base::RuntimeError e;
e.setPyObject(errdata);
Py_DECREF(errdata);