@@ -144,11 +144,10 @@ inline std::string robotModeString(const RobotMode& mode)
144144 return " RUNNING" ;
145145 case RobotMode::UPDATING_FIRMWARE :
146146 return " UPDATING_FIRMWARE" ;
147- default :
148- std::stringstream ss;
149- ss << " Unknown robot mode: " << static_cast <int >(mode);
150- throw std::invalid_argument (ss.str ());
147+ case RobotMode::UNKNOWN :
148+ return " UNKNOWN" ;
151149 }
150+ throw std::invalid_argument (" Unknown robot mode: " + std::to_string (static_cast <int >(mode)));
152151}
153152
154153inline std::string safetyModeString (const SafetyMode& mode)
@@ -197,11 +196,8 @@ inline std::string safetyModeString(const SafetyMode& mode)
197196 return " PROFISAFE_EMERGENCY_STOP" ;
198197 case SafetyMode::SAFETY_API_SAFEGUARD_STOP :
199198 return " SAFETY_API_SAFEGUARD_STOP" ;
200- default :
201- std::stringstream ss;
202- ss << " Unknown safety mode: " << static_cast <int >(mode);
203- throw std::invalid_argument (ss.str ());
204199 }
200+ throw std::invalid_argument (" Unknown safety mode: " + std::to_string (static_cast <int >(mode)));
205201}
206202
207203inline std::string safetyStatusString (const SafetyStatus& status)
@@ -234,11 +230,8 @@ inline std::string safetyStatusString(const SafetyStatus& status)
234230 return " AUTOMATIC_MODE_SAFEGUARD_STOP" ;
235231 case SafetyStatus::SYSTEM_THREE_POSITION_ENABLING_STOP :
236232 return " SYSTEM_THREE_POSITION_ENABLING_STOP" ;
237- default :
238- std::stringstream ss;
239- ss << " Unknown safety status: " << static_cast <int >(status);
240- throw std::invalid_argument (ss.str ());
241233 }
234+ throw std::invalid_argument (" Unknown safety status: " + std::to_string (static_cast <int >(status)));
242235}
243236
244237inline std::string robotTypeString (const RobotType& type)
@@ -263,12 +256,10 @@ inline std::string robotTypeString(const RobotType& type)
263256 return " UR20" ;
264257 case RobotType::UR30 :
265258 return " UR30" ;
266- default :
267- std::stringstream ss;
268- ss << " Unknown Robot Type: " << static_cast <int >(type);
269- URCL_LOG_WARN (ss.str ().c_str ());
259+ case RobotType::UNDEFINED :
270260 return " UNDEFINED" ;
271261 }
262+ throw std::invalid_argument (" Unknown robot type: " + std::to_string (static_cast <int >(type)));
272263}
273264
274265/* *
@@ -290,12 +281,10 @@ inline std::string robotSeriesString(const RobotSeries& series)
290281 return " E_SERIES" ;
291282 case RobotSeries::UR_SERIES :
292283 return " UR_SERIES" ;
293- default :
294- std::stringstream ss;
295- ss << " Unknown Robot Series: " << static_cast <int >(series);
296- URCL_LOG_WARN (ss.str ().c_str ());
284+ case RobotSeries::UNDEFINED :
297285 return " UNDEFINED" ;
298286 }
287+ throw std::invalid_argument (" Unknown robot series: " + std::to_string (static_cast <int >(series)));
299288}
300289
301290} // namespace urcl
0 commit comments