| Home | Libraries | People | FAQ | More

## Class validation_error

boost::program_options::validation_error

## Synopsis

    // In header: <boost/program_options/errors.hpp>

    class validation_error : public boost::program_options::error {
    public:

      enum kind_t { multiple_values_not_allowed =  30,
                    at_least_one_value_required, invalid_bool_value,
                    invalid_option_value, invalid_option };
      // construct/copy/destruct
      validation_error(kind_t, const std::string & = "", const std::string & = "");
      ~validation_error();

      // public member functions
      void set_option_name(const std::string &);
      const std::string & get_option_name() const;
      const char * what() const;

      // protected static functions
      static std::string error_message(kind_t);
    };

## Description

Class thrown when value of option is incorrect.

### `validation_error` public construct/copy/destruct

1.     validation_error(kind_t kind, const std::string & option_value = "",
                        const std::string & option_name = "");

2.     ~validation_error();

### `validation_error` public member functions

1.     void set_option_name(const std::string & option);

2.     const std::string & get_option_name() const;

3.     const char * what() const;

### `validation_error` protected static functions

1.     static std::string error_message(kind_t kind);

   Used to convert kind_t to a related error text