Commit 5e0ae4f4 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Clipboard exceptions: InvalidData

parent 0dae1cbb
......@@ -75,7 +75,7 @@ namespace corryvreckan {
* @brief Retrieve variable from the persistent clipboard storage
* @param name Name of the variable
* @return Stored value from the persistent clipboard storage
* @throws MissingKeyError in case the key is not found.
* @throws MissingDataError in case the key is not found.
*/
double get_persistent(std::string name);
......
......@@ -30,15 +30,26 @@ namespace corryvreckan {
class MissingDataError : public ClipboardError {
public:
/**
* @brief Construct an error for a missing key
* @param key Name of the missing key
* @param section Section where the key should have been defined
* @brief Construct an error for a missing data item
* @param name Name of the missing item
*/
MissingDataError(const std::string& name) {
error_message_ = "No data with key '" + name + "' exists on the clipboard";
}
};
/**
* @ingroup Exceptions
* @brief Informs of invalid data
*/
class InvalidDataError : public ClipboardError {
public:
/**
* @brief Construct an error for invalid data element
* @param reason Reason why the data is invalid
*/
InvalidDataError(const std::string& reason) { error_message_ = "Data invalid: " + reason; }
};
} // namespace corryvreckan
#endif /* CORRYVRECKAN_CONFIG_EXCEPTIONS_H */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment