Skip to content

Commit

Permalink
try catch inside sensor model
Browse files Browse the repository at this point in the history
  • Loading branch information
erinharrington-12 committed Feb 5, 2024
1 parent 0a4fe2d commit feabb65
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions src/Create3SensorModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,28 +128,37 @@ class Create3SensorValueItem : public QStandardItem, public Updateable

static int typeName(Create3SensorModel::SensorMethod name, int port)
{
if(create3_is_connected()) {
try
try
{
if (create3_is_connected())
{
switch (name)
try
{
case Create3SensorModel::Bump:
return create3_sensor_bump(port);
case Create3SensorModel::Cliff:
return create3_sensor_cliff(port);
case Create3SensorModel::IR:
return create3_sensor_ir(port);
default:
break;
switch (name)
{
case Create3SensorModel::Bump:
return create3_sensor_bump(port);
case Create3SensorModel::Cliff:
return create3_sensor_cliff(port);
case Create3SensorModel::IR:
return create3_sensor_ir(port);
default:
break;
}
}
catch (const std::exception &e)
{
std::cerr << e.what() << '\n';
return 0;
}
}
catch (const std::exception &e)
{
std::cerr << e.what() << '\n';
return 0;
}

}
catch (const std::exception &e)
{
std::cerr << e.what() << '\n';
return 0;
}
return 0;
}
};

Expand Down

0 comments on commit feabb65

Please sign in to comment.