Changed throw in main() to return EXIT_FAILURE

This commit is contained in:
babrodtk 2015-05-05 15:48:58 +02:00
parent 862abf6ac7
commit 9edbf38439

View File

@ -101,7 +101,8 @@ try
parameter::ParameterGroup param(argc, argv, false); parameter::ParameterGroup param(argc, argv, false);
if (!param.unhandledArguments().empty()) { if (!param.unhandledArguments().empty()) {
if (param.unhandledArguments().size() != 1) { if (param.unhandledArguments().size() != 1) {
OPM_THROW(std::runtime_error, "You can only specify a single input deck on the command line."); std::cerr << "You can only specify a single input deck on the command line.\n";
return EXIT_FAILURE;
} else { } else {
param.insertParameter("deck_filename", param.unhandledArguments()[0]); param.insertParameter("deck_filename", param.unhandledArguments()[0]);
} }
@ -113,8 +114,8 @@ try
"Specify the deck filename either\n" "Specify the deck filename either\n"
" a) as a command line argument by itself\n" " a) as a command line argument by itself\n"
" b) as a command line parameter with the syntax deck_filename=<path to your deck>, or\n" " b) as a command line parameter with the syntax deck_filename=<path to your deck>, or\n"
" c) as a parameter in a parameter file (.param or .xml) passed to the program."; " c) as a parameter in a parameter file (.param or .xml) passed to the program.\n";
OPM_THROW(std::runtime_error, "Input deck required."); return EXIT_FAILURE;
} }
std::shared_ptr<GridManager> grid; std::shared_ptr<GridManager> grid;
std::shared_ptr<BlackoilPropertiesInterface> props; std::shared_ptr<BlackoilPropertiesInterface> props;
@ -138,7 +139,8 @@ try
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath); std::cerr << "Creating directories failed: " << fpath << std::endl;
return EXIT_FAILURE;
} }
// Write simulation parameters. // Write simulation parameters.
param.writeParam(output_dir + "/simulation.param"); param.writeParam(output_dir + "/simulation.param");
@ -280,6 +282,6 @@ try
} }
catch (const std::exception &e) { catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n"; std::cerr << "Program threw an exception: " << e.what() << "\n";
throw; return EXIT_FAILURE;
} }