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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
const auto sasDescription = plasp::sas::Description::fromFile(variablesMap["input"].as<std::string>());
|
const auto sasDescription = plasp::sas::Description::fromFile(variablesMap["input"].as<std::string>());
|
||||||
sasDescription.print(std::cout);
|
sasDescription.print(std::cout);
|
||||||
|
}
|
||||||
|
catch (const std::exception &e)
|
||||||
|
{
|
||||||
|
std::cerr << "Error: " << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,6 @@ Description Description::fromFile(const boost::filesystem::path &path)
|
|||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
std::ifstream fileStream(path.string(), std::ios::in);
|
std::ifstream fileStream(path.string(), std::ios::in);
|
||||||
fileStream.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
fileStream.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||||
|
|
||||||
@ -49,12 +47,6 @@ Description Description::fromFile(const boost::filesystem::path &path)
|
|||||||
description.parseGoalSection(fileStream);
|
description.parseGoalSection(fileStream);
|
||||||
description.parseOperatorSection(fileStream);
|
description.parseOperatorSection(fileStream);
|
||||||
description.parseAxiomSection(fileStream);
|
description.parseAxiomSection(fileStream);
|
||||||
}
|
|
||||||
catch (std::exception &exception)
|
|
||||||
{
|
|
||||||
std::cerr << "Error: " << exception.what() << std::endl;
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user