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