Cleanup exceptions.
[command.git] / include / exception / optionFailedConversion.h
1 #ifndef __COMMAND_EXCEPTION_OPTION_FAILED_CONVERSION_H
2 #define __COMMAND_EXCEPTION_OPTION_FAILED_CONVERSION_H
3
4 #include <stdexcept>
5 #include <string>
6
7 namespace command {
8
9 /**
10  * Exception thrown used when Option's value failed conversion to specific type
11  *
12  * e.g.:
13  *  "a" -> int
14  */
15 class OptionFailedConversion : public std::invalid_argument {
16 public:
17     /** \inheritdoc */
18     explicit OptionFailedConversion(const std::string& what_arg) :
19         std::invalid_argument(what_arg) { }
20
21     /** \inheritdoc */
22     explicit OptionFailedConversion(const char* what_arg) :
23         std::invalid_argument(what_arg) { }
24 };
25
26 }
27
28 #endif /* __COMMAND_EXCEPTION_OPTION_FAILED_CONVERSION_H */