From: Joel Rosdahl Date: Mon, 20 Feb 2023 19:56:09 +0000 (+0100) Subject: feat: Improve error message when failing to parse command line config X-Git-Tag: v4.8~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8565ec6a72972c2fb8e6676d3dba3e85961b356;p=thirdparty%2Fccache.git feat: Improve error message when failing to parse command line config --- diff --git a/src/Config.cpp b/src/Config.cpp index 3312ac813..42b254c1b 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -664,7 +664,12 @@ void Config::update_from_map(const std::unordered_map& 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())); + } } }