const std::string &filename,
const std::string &last_line)
{
- parse_input(input, filename, last_line);
- return true;
+ try
+ {
+ parse_input(input, filename, last_line);
+ return true;
+ }
+ catch (const ExcIO &exc)
+ {
+ throw;
+ }
+ // This catch block more or less duplicates the old behavior of this function,
+ // which was to print something to stderr for every parsing error (which are
+ // now exceptions) and then return false.
+ catch (const ExceptionBase &exc)
+ {
+ std::cerr << exc.what() << std::endl;
+ }
+ return false;
}
ParameterHandler::read_input_from_string (const char *s,
const std::string &last_line)
{
- parse_input_from_string(s, last_line);
- return true;
+ try
+ {
+ parse_input_from_string (s, last_line);
+ return true;
+ }
+ catch (const ExcIO &exc)
+ {
+ throw;
+ }
+ // This catch block more or less duplicates the old behavior of this function,
+ // which was to print something to stderr for every parsing error (which are
+ // now exceptions) and then return false.
+ catch (const ExceptionBase &exc)
+ {
+ std::cerr << exc.what() << std::endl;
+ }
+ return false;
}
bool ParameterHandler::read_input_from_xml(std::istream &in)
{
- parse_input_from_xml(in);
- return true;
+ try
+ {
+ parse_input_from_xml (in);
+ return true;
+ }
+ catch (const ExcIO &exc)
+ {
+ throw;
+ }
+ catch (const ExceptionBase &exc)
+ {
+ std::cerr << exc.what() << std::endl;
+ }
+ return false;
}
const std::string &filename,
const std::string &last_line)
{
- MultipleParameterLoop::parse_input(input, filename, last_line);
- return true;
+
+ try
+ {
+ MultipleParameterLoop::parse_input(input, filename, last_line);
+ return true;
+ }
+ catch (const ExcIO &exc)
+ {
+ throw;
+ }
+ // This catch block more or less duplicates the old behavior of this function,
+ // which was to print something to stderr for every parsing error (which are
+ // now exceptions) and then return false.
+ catch (const ExceptionBase &exc)
+ {
+ std::cerr << exc.what() << std::endl;
+ }
+ return false;
}
std::ifstream in(p);
try
{
- prm.read_input (in);
+ prm.parse_input (in);
// The first line in the parameter file should not match the given
// pattern, so we should not get here
std::ifstream in(p);
try
{
- prm.read_input (in);
+ prm.parse_input (in);
// The first line in the parameter file should not match the given
// pattern, so we should not get here
std::ifstream in(p);
try
{
- prm.read_input (in);
+ prm.parse_input (in);
}
catch (ParameterHandler::ExcCannotOpenIncludeStatementFile &exc)
{
try
{
- foo.read_input(ss);
+ foo.parse_input(ss);
deallog << "input: ";
foo.enter_subsection("bar");
deallog << foo.get_double ("val") << " ";
catch (ParameterHandler::ExcCannotParseLine &)
{
- deallog << "read_input() failed" << std::endl;
+ deallog << "parse_input() failed" << std::endl;
}
}
DEAL::* check
DEAL::input: 1.00000 2.00000
DEAL::* check
-DEAL::read_input() failed
+DEAL::parse_input() failed
DEAL::* check
-DEAL::read_input() failed
+DEAL::parse_input() failed
DEAL::* check
-DEAL::read_input() failed
+DEAL::parse_input() failed
// We need a local path for the file to get consistent output messages.
const int chdir_return_code = chdir (SOURCE_DIR);
AssertThrow (chdir_return_code == 0, ExcInternalError());
- // test both relevant read_input functions. They should fail with a
+ // test both relevant parse_input functions. They should fail with a
// specific exception.
try
{
if (i == 0)
{
- prm.read_input("prm/parameter_handler_backslash_03.prm");
+ prm.parse_input("prm/parameter_handler_backslash_03.prm");
}
else
{
std::ifstream input_stream
("prm/parameter_handler_backslash_03.prm");
- prm.read_input(input_stream);
+ prm.parse_input(input_stream);
}
- // read_input should fail and we should not get here
+ // parse_input should fail and we should not get here
std::string list;
prm.enter_subsection ("Testing");
list = prm.get ("Function");
// We need a local path for the file to get consistent output messages.
const int chdir_return_code = chdir (SOURCE_DIR);
AssertThrow (chdir_return_code == 0, ExcInternalError());
- // test both relevant read_input functions. They should fail with a
+ // test both relevant parse_input functions. They should fail with a
// specific exception.
try
{
if (i == 0)
{
- prm.read_input("prm/parameter_handler_backslash_04.prm");
+ prm.parse_input("prm/parameter_handler_backslash_04.prm");
}
else
{
std::ifstream input_stream
("prm/parameter_handler_backslash_04.prm");
- prm.read_input(input_stream);
+ prm.parse_input(input_stream);
}
std::string list;
// We need a local path for the file to get consistent output messages.
const int chdir_return_code = chdir (SOURCE_DIR);
AssertThrow (chdir_return_code == 0, ExcInternalError());
- // test both relevant read_input functions
+ // test both relevant parse_input functions
try
{
if (i == 0)
{
- prm.read_input("prm/parameter_handler_backslash_05.prm");
+ prm.parse_input("prm/parameter_handler_backslash_05.prm");
}
else
{
std::ifstream input_stream
("prm/parameter_handler_backslash_05.prm");
- prm.read_input(input_stream);
+ prm.parse_input(input_stream);
}
std::string list_1;