Skip to content

Commit

Permalink
config/config_store: intermediary commit to remove an indentation level
Browse files Browse the repository at this point in the history
this is a non-functional change
  • Loading branch information
andijcr committed Dec 15, 2023
1 parent f8a1ebf commit f0e8f8a
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions src/v/config/config_store.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,34 +82,34 @@ class config_store {
throw std::invalid_argument(
fmt::format("Unknown property {}", name));
}
} else {
auto& found = found_opt.value();
bool ok = false;
try {
auto validation_err = found->second->validate(node.second);
if (validation_err.has_value()) {
errors[name] = fmt::format(
"Validation error: {}",
validation_err.value().error_message());
}

found->second->set_value(node.second);
ok = true;
} catch (YAML::InvalidNode const& e) {
errors[name] = fmt::format("Invalid syntax: {}", e);
} catch (YAML::ParserException const& e) {
errors[name] = fmt::format("Invalid syntax: {}", e);
} catch (YAML::BadConversion const& e) {
errors[name] = fmt::format("Invalid value: {}", e);
continue;
}
auto& found = found_opt.value();
bool ok = false;
try {
auto validation_err = found->second->validate(node.second);
if (validation_err.has_value()) {
errors[name] = fmt::format(
"Validation error: {}",
validation_err.value().error_message());
}

// A validation error is fatal if the property was required,
// e.g. if someone entered a non-integer node_id, or an invalid
// internal RPC address.
if (!ok && found->second->is_required()) {
throw std::invalid_argument(fmt::format(
"Property {} is required and has invalid value", name));
}
found->second->set_value(node.second);
ok = true;
} catch (YAML::InvalidNode const& e) {
errors[name] = fmt::format("Invalid syntax: {}", e);
} catch (YAML::ParserException const& e) {
errors[name] = fmt::format("Invalid syntax: {}", e);
} catch (YAML::BadConversion const& e) {
errors[name] = fmt::format("Invalid value: {}", e);
}

// A validation error is fatal if the property was required,
// e.g. if someone entered a non-integer node_id, or an invalid
// internal RPC address.
if (!ok && found->second->is_required()) {
throw std::invalid_argument(fmt::format(
"Property {} is required and has invalid value", name));
}
}

Expand Down

0 comments on commit f0e8f8a

Please sign in to comment.