Skip to content

Commit 1ce9215

Browse files
author
Felix Exner
committed
Throw an exception when the recipe file cannot be read
1 parent aa9ecc2 commit 1ce9215

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ur_robot_driver/src/rtde/rtde_client.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,13 @@ std::vector<std::string> RTDEClient::readRecipe(const std::string& recipe_file)
323323
{
324324
std::vector<std::string> recipe;
325325
std::ifstream file(recipe_file);
326+
if (file.fail())
327+
{
328+
std::stringstream msg;
329+
msg << "Opening file '" << recipe_file << "' failed with error: " << strerror(errno);
330+
LOG_ERROR("%s", msg.str().c_str());
331+
throw UrException(msg.str());
332+
}
326333
std::string line;
327334
while (std::getline(file, line))
328335
{

0 commit comments

Comments
 (0)