abstract_replication_strategy: Fix exception type if class not found

Change abstract_replication_strategy::create_replication_strategy() to
throw exceptions::configuration_error if replication strategy class
lookup to make sure the error is converted to the correct CQL response.

Fixes #1755

Message-Id: <1476361262-28723-1-git-send-email-penberg@scylladb.com>
(cherry picked from commit 3b4e6cdc5e)
This commit is contained in:
Pekka Enberg
2016-10-13 15:21:02 +03:00
parent a7616b9116
commit ce9468a95d

View File

@@ -54,14 +54,17 @@ static void unwrap_first_range(std::vector<range<token>>& ret) {
std::unique_ptr<abstract_replication_strategy> abstract_replication_strategy::create_replication_strategy(const sstring& ks_name, const sstring& strategy_name, token_metadata& tk_metadata, const std::map<sstring, sstring>& config_options) {
assert(locator::i_endpoint_snitch::get_local_snitch_ptr());
return create_object<abstract_replication_strategy,
const sstring&,
token_metadata&,
snitch_ptr&,
const std::map<sstring, sstring>&>
(strategy_name, ks_name, tk_metadata,
locator::i_endpoint_snitch::get_local_snitch_ptr(), config_options);
try {
return create_object<abstract_replication_strategy,
const sstring&,
token_metadata&,
snitch_ptr&,
const std::map<sstring, sstring>&>
(strategy_name, ks_name, tk_metadata,
locator::i_endpoint_snitch::get_local_snitch_ptr(), config_options);
} catch (const no_such_class& e) {
throw exceptions::configuration_exception(e.what());
}
}
void abstract_replication_strategy::validate_replication_strategy(const sstring& ks_name,