From 400670b87a14f25fd6e2670980b11490bd0cb040 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Mon, 29 Mar 2021 09:27:55 +0200 Subject: [PATCH] Wrap boost error message in ParameterHandler::parse_input_from_json --- source/base/parameter_handler.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/base/parameter_handler.cc b/source/base/parameter_handler.cc index fd93db4123..d20928e43c 100644 --- a/source/base/parameter_handler.cc +++ b/source/base/parameter_handler.cc @@ -761,7 +761,19 @@ ParameterHandler::parse_input_from_json(std::istream &in, boost::property_tree::ptree node_tree; // This boost function will raise an exception if this is not a valid JSON // file. - read_json(in, node_tree); + try + { + read_json(in, node_tree); + } + catch (const std::exception &e) + { + AssertThrow( + false, + ExcMessage( + "The provided JSON file is not valid. Boost aborted with the " + "following assert message: \n\n" + + std::string(e.what()))); + } // The xml function is reused to read in the xml into the parameter file. // This means that only mangled files can be read. -- 2.39.5