From: Peter Munch Date: Mon, 29 Mar 2021 07:27:55 +0000 (+0200) Subject: Wrap boost error message in ParameterHandler::parse_input_from_json X-Git-Tag: v9.3.0-rc1~270^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11976%2Fhead;p=dealii.git Wrap boost error message in ParameterHandler::parse_input_from_json --- 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.