From 45cb2b411851bca921744b24cdff4b3a6f10475e Mon Sep 17 00:00:00 2001 From: Matthias Volk Date: Mon, 19 Nov 2018 00:02:36 +0100 Subject: [PATCH] Better debug message in JsonParser --- src/storm-dft/parser/DFTJsonParser.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/storm-dft/parser/DFTJsonParser.cpp b/src/storm-dft/parser/DFTJsonParser.cpp index b212ee59d..c9f02b016 100644 --- a/src/storm-dft/parser/DFTJsonParser.cpp +++ b/src/storm-dft/parser/DFTJsonParser.cpp @@ -65,7 +65,8 @@ namespace storm { std::vector childNames; if (data.count("children") > 0) { for (std::string const& child : data.at("children")) { - childNames.push_back(nameMapping[child]); + STORM_LOG_THROW(nameMapping.find(child) != nameMapping.end(), storm::exceptions::WrongFormatException, "Child '" << child << "' was not defined."); + childNames.push_back(nameMapping.at(child)); } } @@ -120,7 +121,9 @@ namespace storm { STORM_LOG_THROW(success, storm::exceptions::FileIoException, "Error while adding element '" << element << "'."); } - std::string toplevelName = nameMapping[parseJsonNumber(jsonInput.at("toplevel"))]; + std::string topLevelId = parseJsonNumber(jsonInput.at("toplevel")); + STORM_LOG_THROW(nameMapping.find(topLevelId) != nameMapping.end(), storm::exceptions::WrongFormatException, "Top level element with id '" << topLevelId << "' was not defined."); + std::string toplevelName = nameMapping.at(topLevelId); if(!builder.setTopLevel(toplevelName)) { STORM_LOG_THROW(false, storm::exceptions::FileIoException, "Top level id unknown."); }