From 8ce809c400a3565996715552cf82c17091070ffe Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Tue, 3 Sep 2013 14:41:38 +0200 Subject: [PATCH] Add exception handlers to all unit tests, tutorials and examples --- examples/sim_poly2p_comp_reorder.cpp | 6 ++++++ examples/sim_poly2p_incomp_reorder.cpp | 5 +++++ examples/test_singlecellsolves.cpp | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/examples/sim_poly2p_comp_reorder.cpp b/examples/sim_poly2p_comp_reorder.cpp index cdccc3820..23c077086 100644 --- a/examples/sim_poly2p_comp_reorder.cpp +++ b/examples/sim_poly2p_comp_reorder.cpp @@ -73,6 +73,7 @@ namespace // ----------------- Main program ----------------- int main(int argc, char** argv) +try { using namespace Opm; @@ -345,3 +346,8 @@ main(int argc, char** argv) std::cout << "\n\n================ End of simulation ===============\n\n"; rep.report(std::cout); } +catch (const std::exception &e) { + std::cerr << "Program threw an exception: " << e.what() << "\n"; + throw; +} + diff --git a/examples/sim_poly2p_incomp_reorder.cpp b/examples/sim_poly2p_incomp_reorder.cpp index 8b3644ae7..98a81a8e7 100644 --- a/examples/sim_poly2p_incomp_reorder.cpp +++ b/examples/sim_poly2p_incomp_reorder.cpp @@ -73,6 +73,7 @@ namespace // ----------------- Main program ----------------- int main(int argc, char** argv) +try { using namespace Opm; @@ -349,3 +350,7 @@ main(int argc, char** argv) std::cout << "\n\n================ End of simulation ===============\n\n"; rep.report(std::cout); } +catch (const std::exception &e) { + std::cerr << "Program threw an exception: " << e.what() << "\n"; + throw; +} diff --git a/examples/test_singlecellsolves.cpp b/examples/test_singlecellsolves.cpp index fbee1a3fa..3b0c5c479 100644 --- a/examples/test_singlecellsolves.cpp +++ b/examples/test_singlecellsolves.cpp @@ -60,6 +60,7 @@ // ----------------- Main program ----------------- int main(int argc, char** argv) +try { using namespace Opm; @@ -247,3 +248,8 @@ main(int argc, char** argv) } } } +catch (const std::exception &e) { + std::cerr << "Program threw an exception: " << e.what() << "\n"; + throw; +} +