Improve log message in ConfigObjectUtility::DeleteObjectHelper

refs #5094
This commit is contained in:
Gunnar Beutner 2017-03-27 10:45:27 +02:00
parent f169232ef2
commit 2d6434e96a
1 changed files with 4 additions and 3 deletions

View File

@ -175,9 +175,12 @@ bool ConfigObjectUtility::DeleteObjectHelper(const ConfigObject::Ptr& object, bo
{
std::vector<Object::Ptr> parents = DependencyGraph::GetParents(object);
Type::Ptr type = object->GetReflectionType();
if (!parents.empty() && !cascade) {
if (errors)
errors->Add("Object cannot be deleted because other objects depend on it. "
errors->Add("Object '" + object->GetName() + "' of type '" + type->GetName() +
"' cannot be deleted because other objects depend on it. "
"Use cascading delete to delete it anyway.");
return false;
@ -192,8 +195,6 @@ bool ConfigObjectUtility::DeleteObjectHelper(const ConfigObject::Ptr& object, bo
DeleteObjectHelper(parentObj, cascade, errors);
}
Type::Ptr type = object->GetReflectionType();
ConfigItem::Ptr item = ConfigItem::GetByTypeAndName(type->GetName(), object->GetName());
try {