[program_options] validation_error in 1.42

It seems the way program_options deals with validation errors was changed in 1.42. Constructor of validation_error now takes kind_t and option name and value. Before 1.42 it was possible to specify what exactly was wrong with the option value in the constructor of validation_error. Now I see no options but to subclass validation_error. Was this change intentional? Also, documentation need to be fixed to reflect these changes. More precisely, the following line in "Custom Validators" section will lead to compilation error:
throw validation_error("invalid value");
-- Best regards, Alexander Fokin, ru.elric@gmail.com.

Alexander Fokin wrote:
It seems the way program_options deals with validation errors was changed in 1.42.
Constructor of validation_error now takes kind_t and option name and value. Before 1.42 it was possible to specify what exactly was wrong with the option value in the constructor of validation_error. Now I see no options but to subclass validation_error. Was this change intentional?
It would expect so. IIUC, the change was made so that code that catches validation_error can emit localized or otherwise customized error message. Maybe, there should be an additional parameter to specify details?
Also, documentation need to be fixed to reflect these changes. More precisely, the following line in "Custom Validators" section will lead to compilation error:
throw validation_error("invalid value");
Could you file an issue on http://svn.boost.org about this? Thanks, Volodya

It would expect so. IIUC, the change was made so that code that catches validation_error can emit localized or otherwise customized error message. Maybe, there should be an additional parameter to specify details? Yes, that would be nice. I think this additional parameter must also be present in the constructor for invalid_option_value.
Could you file an issue on http://svn.boost.org about this? Done. See ticket #3992.
-- Best regards, Alexander Fokin, ru.elric@gmail.com.
participants (3)
-
Alexander Fokin
-
Elric
-
Vladimir Prus