diff --git a/apps/plasp-app/main.cpp b/apps/plasp-app/main.cpp index 0373303..f92e226 100644 --- a/apps/plasp-app/main.cpp +++ b/apps/plasp-app/main.cpp @@ -37,8 +37,15 @@ int main(int argc, char **argv) return EXIT_FAILURE; } - const auto sasDescription = plasp::sas::Description::fromFile(variablesMap["input"].as()); - sasDescription.print(std::cout); + try + { + const auto sasDescription = plasp::sas::Description::fromFile(variablesMap["input"].as()); + sasDescription.print(std::cout); + } + catch (const std::exception &e) + { + std::cerr << "Error: " << e.what() << std::endl; + } return EXIT_SUCCESS; } diff --git a/src/plasp/sas/Description.cpp b/src/plasp/sas/Description.cpp index 4a153d1..bf24cfc 100644 --- a/src/plasp/sas/Description.cpp +++ b/src/plasp/sas/Description.cpp @@ -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; }