Skip to content
Snippets Groups Projects
Commit 335ab739 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Throw proper exception if skill is not found when constructing subskill proxy

parent 56214975
No related branches found
No related tags found
No related merge requests found
......@@ -245,7 +245,7 @@ namespace armarx
std::string("The skill '" + getSkillId().toString() + "' was asked to stop.");
message += abortedMessage.empty() ? "" : " Additional message: " + abortedMessage;
throw error::SkillAbortedException(message);
throw error::SkillAbortedException(__PRETTY_FUNCTION__, message);
return;
}
......@@ -256,7 +256,7 @@ namespace armarx
message += abortedMessage.empty() ? "" : " Additional message: " + abortedMessage;
ARMARX_WARNING << message;
throw error::SkillFailedException(message);
throw error::SkillFailedException(__PRETTY_FUNCTION__, message);
}
}
......
......@@ -12,9 +12,19 @@ namespace armarx
manager(manager)
{
ARMARX_CHECK_NOT_NULL(manager);
skillDescription = SkillDescription::FromIce(
manager->getSkillDescription(skillId.toManagerIce()).value());
ARMARX_CHECK(skillDescription.skillId.isFullySpecified());
IceUtil::Optional<manager::dto::SkillDescription> description =
manager->getSkillDescription(skillId.toManagerIce());
if (description)
{
skillDescription = SkillDescription::FromIce(description.value());
ARMARX_CHECK(skillDescription.skillId.isFullySpecified());
}
else
{
std::stringstream reason;
reason << "No skill with ID " << skillId << " found";
throw error::SkillNotFoundException(__PRETTY_FUNCTION__, reason.str());
}
}
SkillProxy::SkillProxy(const manager::dti::SkillManagerInterfacePrx& manager,
......
......@@ -48,32 +48,38 @@ namespace armarx::skills::error
}
};
class SkillAbortedException : public armarx::LocalException
/**
* @brief Indicates that a skill was not found, e.g., by the skill manager.
*/
class SkillNotFoundException : public SkillException
{
public:
SkillAbortedException() = delete;
SkillNotFoundException() = delete;
SkillAbortedException(const std::string& reason) : LocalException(reason)
SkillNotFoundException(const std::string& prettymethod, const std::string& reason) :
SkillException(prettymethod, reason)
{
}
};
class SkillAbortedException : public SkillException
{
public:
SkillAbortedException() = delete;
SkillAbortedException(const std::string& prettymethod, const std::string& reason) :
LocalException(prettymethod + ": " + reason + ".")
SkillException(prettymethod, reason)
{
}
};
class SkillFailedException : public armarx::LocalException
class SkillFailedException : public SkillException
{
public:
SkillFailedException() = delete;
SkillFailedException(const std::string& reason) : LocalException(reason)
{
}
SkillFailedException(const std::string& prettymethod, const std::string& reason) :
LocalException(prettymethod + ": " + reason + ".")
SkillException(prettymethod, reason)
{
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment