Re: [Boost-bugs] [Boost C++ Libraries] #3423: Diagnostic of errors.

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3423: Diagnostic of errors.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-11-24 05:55:39


#3423: Diagnostic of errors.
---------------------------------------------+------------------------------
  Reporter: Alex Bukreev <bucreev@…> | Owner: vladimir_prus
      Type: Feature Requests | Status: reopened
 Milestone: Boost 1.41.0 | Component: program_options
   Version: Boost 1.40.0 | Severity: Problem
Resolution: | Keywords:
---------------------------------------------+------------------------------
Changes (by Alex Bukreev <bucreev@…>):

  * status: closed => reopened
  * resolution: fixed =>

Comment:

 I’ve looked through your changes.
 There are 12 classes declared in file “errors.hpp”.

 1. class “error” – base class, exception in this class are not generated
 (i suggest to declare its constructor as ‘protected’).

 2. class “invalid_syntax” – there is a “msg” parameter of type ‘string’
 which is specified in constructor, it is necessary to swap its parameter
 type to ‘enum’ with storing of its value (like it’s done in class
 â€œinvalid_command_line_syntax”).

 3. class “unknown_option” – ok.

 4. class “ambiguous_option” - – there is a “name” parameter specified in
 constructor. Parameter value must be stored.

 5. class "multiple_values" - there is a “what” parameter specified in
 constructor which is always equal to "multiple_values" parameter.
 - remove “what” parameter from constructor.

 6. class "multiple_occurrences" - there is a “what” parameter specified in
 constructor which is always equal to "multiple_values" parameter.
 - remove “what” parameter from constructor.

 7. class "validation_error - there is a “what” parameter of type ‘string’
 specified in constructor. It is necessary to swap its parameter type to
 â€˜enum’ with storing of its value.

 8. class "invalid_option_value" - value of parameter "bad_value" is not
 stored.

 9. class "too_many_positional_options_error" – if this exception may occur
 only because of programmer(not user) mistake, then it’s ok.

 10. class "too_few_positional_options_error" - if this exception may occur
 only because of programmer(not user) mistake, then it’s ok.

 11. class "invalid_command_line_syntax" – ok

 12. class "invalid_command_line_style" - if this exception may occur only
 because of programmer(not user) mistake, then it’s ok.


 While testing of “error” classes were detected the following:
 1.Source one:
    options_description desc;
    desc.add_options()
         ("cfgfile,c", value<string>()->multitoken(), "the config file")
         ("output,c", value<string>(), "the output file")
         ("output,o", value<string>(), "the output file")
       ;

    const char* cmdline[] = {"program", "-c", "file", "-o", "anotherfile"};

 No mistake detected!!!

 2.Source two:
    desc.add_options()
         ("cfgfile,c", value<string>()->multitoken(), "the config file")
         ("output,o", value<string>(), "the output file")
       ;

    const char* cmdline[] = {"program", "-c", "-o", "anotherfile"};

 Wrong diagnostic: "in option 'cfgfile': multiple values not allowed"

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3423#comment:5>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC