Boost logo

Boost Users :

From: Peter Gerell (boost_at_[hidden])
Date: 2006-05-31 05:31:57

I would like to know the name of the option that causes the command line
parsing to fail.
I don't like the idea of having to parse the what() string to extract the
option name.
I think the exception classes should be extended with functions to get this
This is useful if you want to control the appearance of the error messages.
E.g. use another language than English.

In short I would like to do something like this:

try {
} catch ( const po::multiple_occurrences& e) {
   std::cerr << "multiple occurrences of option " << e.option_name();
} catch ( const po::unknown_option& e ) {
  std::cerr << "unknown option " << e.option_name();
} catch ( const po::invalid_syntax& e ) {
  std::cerr << e.what());
} catch ( const po::error& e ) {
  std::cerr << e.what());


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at