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-12-04 13:39:24


#3423: Diagnostic of errors.
---------------------------------------------+------------------------------
  Reporter: Alex Bukreev <bucreev@…> | Owner: s_ochsenknecht
      Type: Feature Requests | Status: assigned
 Milestone: Boost 1.42.0 | Component: program_options
   Version: Boost 1.40.0 | Severity: Problem
Resolution: | Keywords:
---------------------------------------------+------------------------------

Comment(by s_ochsenknecht):

 I hope I cleaned it up a bit. I divided this "workpackage" into two parts
 to avoid big changes in one commit.
 So, first part is cleaning up of the exception classes (point 1-12),
 second part will be debugging the two things Alex detected.

 First part is done and already on trunk, see my comments below. Second
 part will come soon, keep the ticket open.


 Replying to [comment:5 Alex Bukreev <bucreev@…>]:
> 1. class “error” – base class, exception in this class are not generated
 (i suggest to declare its constructor as ‘protected’).

   -> Currently class error is thrown from several places within the
 library.
      I would suggest to introduce a new exception class for them,
 something
      like miscellaneous_error and then make constructor 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”).

    -> DONE. Moved the "kind" to base class invalid_syntax.

> 3. class “unknown_option” – ok.

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

   -> DONE

> 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.

   -> DONE

> 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.

   -> DONE

> 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.

  -> DONE, introduce a kind_t and related function to derive message from
      kind.

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

  -> stored now in base class: validation_error

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

   -> comment added, removed what parameter


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

  -> class is not used - removed

> 11. class "invalid_command_line_syntax" – ok

    -> see 2., moved kind_t to base class

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

    -> Comment added


 In general there are still some TODO's in the code. Storing non-trivial
 values in exception class might be a bad idea, because their constructors
 can throw.
 But I think these things can be kept in for now and marked with a TODO,
 cleaning up those would be another ticket.

 With "part-2" I'll also update the test case and add some more checks.

 Please comment! Reviewing is welcome!

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3423#comment:8>
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:02 UTC