Files
scylladb/utils
Kefu Chai c1beba1f7d utils: config_file: throw bpo::invalid_option_value() when seeing invalid option
before this change, `std::invalid_argument` is thrown by
`bpo::notify(configuration)` in `app_template::run_deprecated()` when
invalid option is passed in via command line. `utils::named_value`
throws `std::invalid_argument` if the given value is not listed in
`_allowed_values`. but we don't handle `std::invalid_argument` in
`app_template::run_deprecated()`. so the application aborts with
unhandled exception if the specified argument is not allowed.

in this change, we convert the `std::invalid_argument` to a
derived class of `bpo::error` in the customized notify handler,
so that it can be handled in `app_template::run_deprecated()`.

because `name_value::operator()` is also used otherwhere, we
should not throw a bpo::error there. so its exception type
is preserved.

Fixes #16687
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#16688
2024-01-09 11:49:06 +02:00
..
2023-09-11 14:38:46 +03:00
2023-12-02 22:37:22 +02:00
2023-12-02 22:37:22 +02:00
2023-12-02 22:37:22 +02:00
2022-06-02 11:21:05 +03:00
2023-12-05 15:18:11 +02:00
2023-09-11 14:38:46 +03:00
2023-12-02 22:37:22 +02:00
2023-12-05 15:18:11 +02:00
2023-12-05 15:18:11 +02:00
2023-12-02 22:37:22 +02:00
2023-12-02 22:37:22 +02:00
2023-12-05 15:18:11 +02:00
2023-09-01 22:34:23 +02:00
2023-12-02 22:37:22 +02:00
2023-01-27 19:15:39 +01:00
2023-12-02 22:37:22 +02:00