Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patches: Improve location logging for invalid note sequence #14474

Merged
merged 1 commit into from Aug 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 17 additions & 9 deletions Utilities/bin_patch.cpp
Expand Up @@ -378,13 +378,21 @@ bool patch_engine::load(patch_map& patches_map, const std::string& path, std::st
{
for (const auto note : notes_node)
{
if (note && note.IsScalar())
if (note)
{
info.notes += note.Scalar();
if (note.IsScalar())
{
info.notes += note.Scalar();
}
else
{
append_log_message(log_messages, fmt::format("Error: Skipping sequenced Note (patch: %s, key: %s, location: %s, file: %s)", description, main_key, get_yaml_node_location(note), path), &patch_log.error);
is_valid = false;
}
}
else
{
append_log_message(log_messages, fmt::format("Error: Skipping sequenced Note (patch: %s, key: %s, location: %s, file: %s)", description, main_key, get_yaml_node_location(note), path), &patch_log.error);
append_log_message(log_messages, fmt::format("Error: Skipping sequenced Note (patch: %s, key: %s, location: %s, file: %s)", description, main_key, get_yaml_node_location(notes_node), path), &patch_log.error);
is_valid = false;
}
}
Expand Down Expand Up @@ -1752,9 +1760,9 @@ bool patch_engine::save_patches(const patch_map& patches, const std::string& pat
{
out << serial << YAML::BeginSeq;

for (const auto& app_version : app_versions)
for (const auto& [app_version, patch_config] : app_versions)
{
out << app_version.first;
out << app_version;
}

out << YAML::EndSeq;
Expand Down Expand Up @@ -1891,7 +1899,7 @@ patch_engine::patch_map patch_engine::load_config()

for (const auto pair : root)
{
const auto& hash = pair.first.Scalar();
const std::string& hash = pair.first.Scalar();

if (const auto yml_type = pair.second.Type(); yml_type != YAML::NodeType::Map)
{
Expand All @@ -1901,7 +1909,7 @@ patch_engine::patch_map patch_engine::load_config()

for (const auto patch : pair.second)
{
const auto& description = patch.first.Scalar();
const std::string& description = patch.first.Scalar();

if (const auto yml_type = patch.second.Type(); yml_type != YAML::NodeType::Map)
{
Expand All @@ -1911,7 +1919,7 @@ patch_engine::patch_map patch_engine::load_config()

for (const auto title_node : patch.second)
{
const auto& title = title_node.first.Scalar();
const std::string& title = title_node.first.Scalar();

if (const auto yml_type = title_node.second.Type(); yml_type != YAML::NodeType::Map)
{
Expand All @@ -1921,7 +1929,7 @@ patch_engine::patch_map patch_engine::load_config()

for (const auto serial_node : title_node.second)
{
const auto& serial = serial_node.first.Scalar();
const std::string& serial = serial_node.first.Scalar();

if (const auto yml_type = serial_node.second.Type(); yml_type != YAML::NodeType::Map)
{
Expand Down