|
32 | 32 | #include <chrono> |
33 | 33 | #include <stdexcept> |
34 | 34 | #include <sstream> |
| 35 | +#include "ur/version_information.h" |
35 | 36 |
|
36 | 37 | namespace urcl |
37 | 38 | { |
@@ -129,13 +130,14 @@ class IncompatibleRobotVersion : public UrException |
129 | 130 | { |
130 | 131 | public: |
131 | 132 | explicit IncompatibleRobotVersion() = delete; |
132 | | - explicit IncompatibleRobotVersion(const std::string& text, const VersionInformation& minimum_robot_version, const VersionInformation& actual_robot_version) |
| 133 | + explicit IncompatibleRobotVersion(const std::string& text, const VersionInformation& minimum_robot_version, |
| 134 | + const VersionInformation& actual_robot_version) |
133 | 135 | : std::runtime_error(text) |
134 | 136 | { |
135 | 137 | std::stringstream ss; |
136 | 138 | ss << text << "\n" |
137 | 139 | << "The requested feature is incompatible with the connected robot. Minimum required Polyscope version: " |
138 | | - << required_robot_version << ", actual Polyscope version: " << actual_robot_version; |
| 140 | + << minimum_robot_version << ", actual Polyscope version: " << actual_robot_version; |
139 | 141 | text_ = ss.str(); |
140 | 142 | } |
141 | 143 | virtual const char* what() const noexcept override |
@@ -163,5 +165,27 @@ class InvalidRange : public UrException |
163 | 165 | return text_.c_str(); |
164 | 166 | } |
165 | 167 | }; |
| 168 | + |
| 169 | +class MissingArgument : public UrException |
| 170 | +{ |
| 171 | +private: |
| 172 | + std::string text_; |
| 173 | + |
| 174 | +public: |
| 175 | + explicit MissingArgument() = delete; |
| 176 | + explicit MissingArgument(std::string text, std::string function_name, std::string argument_name, float default_value) |
| 177 | + : std::runtime_error("") |
| 178 | + { |
| 179 | + std::stringstream ss; |
| 180 | + ss << text << "\nMissing argument when calling function: " << function_name |
| 181 | + << ". \nArgument missing: " << argument_name |
| 182 | + << ". \nSet to default value if not important, default value is: " << default_value; |
| 183 | + text_ = ss.str(); |
| 184 | + } |
| 185 | + virtual const char* what() const noexcept override |
| 186 | + { |
| 187 | + return text_.c_str(); |
| 188 | + } |
| 189 | +}; |
166 | 190 | } // namespace urcl |
167 | 191 | #endif // ifndef UR_CLIENT_LIBRARY_EXCEPTIONS_H_INCLUDED |
0 commit comments