add specialized exception type for bad graphs

This commit is contained in:
wmayer
2018-11-26 14:15:19 +01:00
parent 42b689b464
commit 7ceac311b3
5 changed files with 45 additions and 5 deletions

View File

@@ -304,7 +304,7 @@ void _getInListRecursive(std::set<DocumentObject*>& objSet,
for (const auto objIt : obj->getInList()) {
// if the check object is in the recursive inList we have a cycle!
if (objIt == checkObj || depth <= 0) {
throw Base::RuntimeError("DocumentObject::getInListRecursive(): cyclic dependency detected!");
throw Base::BadGraphError("DocumentObject::getInListRecursive(): cyclic dependency detected!");
}
// if the element was already in the set then there is no need to process it again
@@ -335,7 +335,7 @@ void _getOutListRecursive(std::set<DocumentObject*>& objSet,
for (const auto objIt : obj->getOutList()) {
// if the check object is in the recursive inList we have a cycle!
if (objIt == checkObj || depth <= 0) {
throw Base::RuntimeError("DocumentObject::getOutListRecursive(): cyclic dependency detected!");
throw Base::BadGraphError("DocumentObject::getOutListRecursive(): cyclic dependency detected!");
}
// if the element was already in the set then there is no need to process it again
@@ -369,7 +369,7 @@ bool _isInInListRecursive(const DocumentObject* act,
return true;
// if we reach the depth limit we have a cycle!
if (depth <= 0) {
throw Base::RuntimeError("DocumentObject::isInInListRecursive(): cyclic dependency detected!");
throw Base::BadGraphError("DocumentObject::isInInListRecursive(): cyclic dependency detected!");
}
if (_isInInListRecursive(obj, checkObj, depth - 1))
@@ -413,7 +413,7 @@ bool _isInOutListRecursive(const DocumentObject* act,
return true;
// if we reach the depth limit we have a cycle!
if (depth <= 0) {
throw Base::RuntimeError("DocumentObject::isInOutListRecursive(): cyclic dependency detected!");
throw Base::BadGraphError("DocumentObject::isInOutListRecursive(): cyclic dependency detected!");
}
if (_isInOutListRecursive(obj, checkObj, depth - 1))