cli11
Loading...
Searching...
No Matches
cli::error_t Class Referenceexport
module cli11

Base of every exception the library throws. More...

Inheritance diagram for cli::error_t:
cli::detail::error_mixin_t< construction_error_t, error_t > cli::detail::error_mixin_t< parse_error_t, error_t > cli::detail::error_mixin_t< option_not_found_t, error_t > cli::construction_error_t cli::parse_error_t cli::option_not_found_t cli::detail::error_mixin_t< incorrect_construction_t, construction_error_t > cli::detail::error_mixin_t< bad_name_string_t, construction_error_t > cli::detail::error_mixin_t< option_already_added_t, construction_error_t > cli::detail::error_mixin_t< success_t, parse_error_t > cli::detail::error_mixin_t< runtime_error_t, parse_error_t > cli::detail::error_mixin_t< file_error_t, parse_error_t > cli::detail::error_mixin_t< conversion_error_t, parse_error_t > cli::detail::error_mixin_t< validation_error_t, parse_error_t > cli::detail::error_mixin_t< required_error_t, parse_error_t > cli::detail::error_mixin_t< argument_mismatch_t, parse_error_t > cli::detail::error_mixin_t< requires_error_t, parse_error_t > cli::detail::error_mixin_t< excludes_error_t, parse_error_t > cli::detail::error_mixin_t< extras_error_t, parse_error_t > cli::detail::error_mixin_t< config_error_t, parse_error_t > cli::detail::error_mixin_t< invalid_error_t, parse_error_t > cli::detail::error_mixin_t< horrible_error_t, parse_error_t >

Public Member Functions

auto get_exit_code () const -> int
 Returns the process exit code associated with this error.
auto get_name () const -> std::string
 Returns the short name of this error type.
 error_t (std::string name, std::string msg, int exit_code=static_cast< int >(exit_codes_t::base_class))
 Constructs an error with an explicit numeric exit code.
 error_t (std::string name, std::string msg, exit_codes_t exit_code)
 Constructs an error with an exit code drawn from exit_codes_t.

Detailed Description

Base of every exception the library throws.

Constructor & Destructor Documentation

◆ error_t() [1/2]

cli::error_t::error_t ( std::string name,
std::string msg,
int exit_code = static_cast<int>(exit_codes_t::base_class) )
inline

Constructs an error with an explicit numeric exit code.

Parameters
nameShort name of the error type.
msgHuman-readable description.
exit_codeProcess exit code to report.

◆ error_t() [2/2]

cli::error_t::error_t ( std::string name,
std::string msg,
exit_codes_t exit_code )
inline

Constructs an error with an exit code drawn from exit_codes_t.

Parameters
nameShort name of the error type.
msgHuman-readable description.
exit_codeProcess exit code to report.

Member Function Documentation

◆ get_exit_code()

auto cli::error_t::get_exit_code ( ) const -> int
inlinenodiscard

Returns the process exit code associated with this error.

Returns
The exit code.

◆ get_name()

auto cli::error_t::get_name ( ) const -> std::string
inlinenodiscard

Returns the short name of this error type.

Returns
The error name, for example "validation_error".

The documentation for this class was generated from the following file:
  • /home/mccakit/desktop/repositories/cli11/src/error.cpp