Moved exception catching from parser to application.
This commit is contained in:
parent
3ddf942a12
commit
d7984e9b3a
@ -37,8 +37,15 @@ int main(int argc, char **argv)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
const auto sasDescription = plasp::sas::Description::fromFile(variablesMap["input"].as<std::string>());
|
||||
sasDescription.print(std::cout);
|
||||
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;
|
||||
}
|
||||
|
@ -36,25 +36,17 @@ 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);
|
||||
std::ifstream fileStream(path.string(), std::ios::in);
|
||||
fileStream.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
|
||||
description.parseVersionSection(fileStream);
|
||||
description.parseMetricSection(fileStream);
|
||||
description.parseVariablesSection(fileStream);
|
||||
description.parseMutexSection(fileStream);
|
||||
description.parseInitialStateSection(fileStream);
|
||||
description.parseGoalSection(fileStream);
|
||||
description.parseOperatorSection(fileStream);
|
||||
description.parseAxiomSection(fileStream);
|
||||
}
|
||||
catch (std::exception &exception)
|
||||
{
|
||||
std::cerr << "Error: " << exception.what() << std::endl;
|
||||
return description;
|
||||
}
|
||||
description.parseVersionSection(fileStream);
|
||||
description.parseMetricSection(fileStream);
|
||||
description.parseVariablesSection(fileStream);
|
||||
description.parseMutexSection(fileStream);
|
||||
description.parseInitialStateSection(fileStream);
|
||||
description.parseGoalSection(fileStream);
|
||||
description.parseOperatorSection(fileStream);
|
||||
description.parseAxiomSection(fileStream);
|
||||
|
||||
return description;
|
||||
}
|
||||
|
Reference in New Issue
Block a user