Skip to content

Commit b43ef46

Browse files
committed
Throw an exception on failed driver initialization
1 parent b93c730 commit b43ef46

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/example_robot_wrapper.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include <ur_client_library/example_robot_wrapper.h>
3232
#include <iostream>
33+
#include "ur_client_library/exceptions.h"
3334

3435
namespace urcl
3536
{
@@ -45,7 +46,11 @@ ExampleRobotWrapper::ExampleRobotWrapper(const std::string& robot_ip, const std:
4546
{
4647
URCL_LOG_ERROR("Could not connect to dashboard");
4748
}
48-
initializeRobotWithDashboard();
49+
50+
if (!initializeRobotWithDashboard())
51+
{
52+
throw UrException("Could not initialize robot with dashboard");
53+
}
4954

5055
std::unique_ptr<ToolCommSetup> tool_comm_setup;
5156
ur_driver_ =
@@ -62,7 +67,7 @@ ExampleRobotWrapper::ExampleRobotWrapper(const std::string& robot_ip, const std:
6267
{
6368
if (!waitForProgramRunning(500))
6469
{
65-
URCL_LOG_ERROR("Program did not start running. Is the robot in remote control?");
70+
throw UrException("Program did not start running. Is the robot in remote control?");
6671
}
6772
}
6873
}

0 commit comments

Comments
 (0)