From 7dc13bd2d62334fcfefc7b8e92d905461e707a0b Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 14 Nov 2018 23:17:42 +0100 Subject: [PATCH] Replace Base::Exception with appropriate subclass --- src/App/GeoFeatureGroupExtension.cpp | 8 ++++---- src/App/GroupExtension.cpp | 6 +++--- src/Base/Exception.h | 1 - src/Gui/PythonConsole.cpp | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/App/GeoFeatureGroupExtension.cpp b/src/App/GeoFeatureGroupExtension.cpp index cad6fba6a6..c311ab491e 100644 --- a/src/App/GeoFeatureGroupExtension.cpp +++ b/src/App/GeoFeatureGroupExtension.cpp @@ -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"); } } } diff --git a/src/App/GroupExtension.cpp b/src/App/GroupExtension.cpp index eee5a51c12..db76dc4709 100644 --- a/src/App/GroupExtension.cpp +++ b/src/App/GroupExtension.cpp @@ -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 ( @@ -227,7 +227,7 @@ bool GroupExtension::recursiveHasObject(const DocumentObject* obj, const GroupEx auto ext = child->getExtensionByType(); 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"); } } } diff --git a/src/Base/Exception.h b/src/Base/Exception.h index d104d5e7c4..b2dfdcac26 100644 --- a/src/Base/Exception.h +++ b/src/Base/Exception.h @@ -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 diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index 804ef01535..a1e414ea82 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -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);