Skip to content

Commit 12ee23a

Browse files
committed
Improve error messages
1 parent 82342a6 commit 12ee23a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/project_parser.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
219219
cmake.required("version", cmake_version);
220220

221221
if (cmake.contains("bin-dir")) {
222-
throw std::runtime_error("bin-dir has been renamed to build-dir");
222+
throw std::runtime_error(format_key_error("bin-dir has been renamed to build-dir", "bin-dir", cmake.find("bin-dir")));
223223
}
224224

225225
cmake.optional("build-dir", build_dir);
@@ -473,7 +473,7 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
473473
}
474474

475475
if (checker.contains("bin")) {
476-
throw std::runtime_error("[[bin]] has been renamed to [[target]]");
476+
throw std::runtime_error(format_key_error("[[bin]] has been renamed to [target.<name>]", "", toml.at("bin")));
477477
}
478478

479479
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
711711
package.features.emplace_back(feature);
712712
}
713713
} else {
714-
throw std::runtime_error("Invalid vcpkg package '" + package_str + "'");
714+
throw std::runtime_error(format_key_error("Invalid package name '" + package_str + "'", "packages", p));
715715
}
716716
vcpkg.packages.emplace_back(std::move(package));
717717
}

0 commit comments

Comments
 (0)