From 24155ae7d31167cd93d9bb4b48d92c8626a27676 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 18 Aug 2019 00:42:48 +0200 Subject: [PATCH] more informative message when setting inexistant config items --- src/xbt/config.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/xbt/config.cpp b/src/xbt/config.cpp index c50e8057a1..e51a1ba34f 100644 --- a/src/xbt/config.cpp +++ b/src/xbt/config.cpp @@ -307,7 +307,10 @@ inline ConfigurationElement* Config::get_dict_element(const std::string& name) XBT_INFO("Option %s has been renamed to %s. Consider switching.", name.c_str(), res->get_key().c_str()); return res; } else { - throw std::out_of_range("Bad config key: " + name); + std::string msg = "Bad config key: " + name + "\nExisting config keys:\n"; + for (auto const& elm : options) + msg += " " + elm.first + ": (" + elm.second->get_type_name() + ")" + elm.second->get_string_value() + "\n"; + throw std::out_of_range(msg); } } } -- 2.20.1