]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
feat: Improve error message when failing to parse command line config
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 20 Feb 2023 19:56:09 +0000 (20:56 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 4 Mar 2023 09:10:19 +0000 (10:10 +0100)
src/Config.cpp

index 3312ac8139bb8daeae271ec29d6cd138c6a63154..42b254c1bb0089a285f22b209a827dc31b87a239 100644 (file)
@@ -664,7 +664,12 @@ void
 Config::update_from_map(const std::unordered_map<std::string, std::string>& map)
 {
   for (const auto& [key, value] : map) {
-    set_item(key, value, std::nullopt, false, "command line");
+    try {
+      set_item(key, value, std::nullopt, false, "command line");
+    } catch (core::Error& e) {
+      throw core::Error(
+        FMT("when parsing command line config \"{}\": {}", key, e.what()));
+    }
   }
 }