mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-30 20:53:52 +00:00
Adding easier-to-subclass error type
This commit is contained in:
parent
f221269db0
commit
32a70aeb9e
@ -39,10 +39,12 @@ enum class ExitCodes {
|
|||||||
|
|
||||||
/// All errors derive from this one
|
/// All errors derive from this one
|
||||||
struct Error : public std::runtime_error {
|
struct Error : public std::runtime_error {
|
||||||
ExitCodes exit_code;
|
int exit_code;
|
||||||
bool print_help;
|
bool print_help;
|
||||||
int get_exit_code() const {return static_cast<int>(exit_code);}
|
int get_exit_code() const {return exit_code;}
|
||||||
Error(std::string parent, std::string name, ExitCodes exit_code=ExitCodes::BaseClass, bool print_help=true)
|
Error(std::string parent, std::string name, ExitCodes exit_code=ExitCodes::BaseClass, bool print_help=true)
|
||||||
|
: runtime_error(parent + ": " + name), exit_code(static_cast<int>(exit_code)), print_help(print_help) {}
|
||||||
|
Error(std::string parent, std::string name, int exit_code=static_cast<int>(ExitCodes::BaseClass), bool print_help=true)
|
||||||
: runtime_error(parent + ": " + name), exit_code(exit_code), print_help(print_help) {}
|
: runtime_error(parent + ": " + name), exit_code(exit_code), print_help(print_help) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user