Improve error messages

main
Duncan Ogilvie 2 years ago
parent 82342a6b6f
commit 12ee23a44c

@ -219,7 +219,7 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
cmake.required("version", cmake_version); cmake.required("version", cmake_version);
if (cmake.contains("bin-dir")) { if (cmake.contains("bin-dir")) {
throw std::runtime_error("bin-dir has been renamed to build-dir"); throw std::runtime_error(format_key_error("bin-dir has been renamed to build-dir", "bin-dir", cmake.find("bin-dir")));
} }
cmake.optional("build-dir", build_dir); cmake.optional("build-dir", build_dir);
@ -473,7 +473,7 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
} }
if (checker.contains("bin")) { if (checker.contains("bin")) {
throw std::runtime_error("[[bin]] has been renamed to [[target]]"); throw std::runtime_error(format_key_error("[[bin]] has been renamed to [target.<name>]", "", toml.at("bin")));
} }
auto parse_target = [&](const std::string &name, TomlChecker &t, bool isTemplate) { auto parse_target = [&](const std::string &name, TomlChecker &t, bool isTemplate) {
@ -711,7 +711,7 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
package.features.emplace_back(feature); package.features.emplace_back(feature);
} }
} else { } else {
throw std::runtime_error("Invalid vcpkg package '" + package_str + "'"); throw std::runtime_error(format_key_error("Invalid package name '" + package_str + "'", "packages", p));
} }
vcpkg.packages.emplace_back(std::move(package)); vcpkg.packages.emplace_back(std::move(package));
} }

Loading…
Cancel
Save