Moved exception catching from parser to application.

This commit is contained in:
Patrick Lühne 2016-05-20 16:16:56 +02:00
parent 3ddf942a12
commit d7984e9b3a
2 changed files with 19 additions and 20 deletions

View File

@ -37,8 +37,15 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
try
{
const auto sasDescription = plasp::sas::Description::fromFile(variablesMap["input"].as<std::string>());
sasDescription.print(std::cout);
}
catch (const std::exception &e)
{
std::cerr << "Error: " << e.what() << std::endl;
}
return EXIT_SUCCESS;
}

View File

@ -36,8 +36,6 @@ Description Description::fromFile(const boost::filesystem::path &path)
return description;
}
try
{
std::ifstream fileStream(path.string(), std::ios::in);
fileStream.exceptions(std::ifstream::failbit | std::ifstream::badbit);
@ -49,12 +47,6 @@ Description Description::fromFile(const boost::filesystem::path &path)
description.parseGoalSection(fileStream);
description.parseOperatorSection(fileStream);
description.parseAxiomSection(fileStream);
}
catch (std::exception &exception)
{
std::cerr << "Error: " << exception.what() << std::endl;
return description;
}
return description;
}