From 12ee23a44c9c6dede14c5c4e16ec840b8697c683 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Sat, 14 Jan 2023 15:52:19 +0100 Subject: [PATCH] Improve error messages --- src/project_parser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/project_parser.cpp b/src/project_parser.cpp index ceb7a99..81731aa 100644 --- a/src/project_parser.cpp +++ b/src/project_parser.cpp @@ -219,7 +219,7 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p cmake.required("version", cmake_version); 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); @@ -473,7 +473,7 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p } 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.]", "", toml.at("bin"))); } 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); } } 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)); }