From: David Wells Date: Fri, 17 Mar 2017 00:38:43 +0000 (-0400) Subject: Improve exception handling in two tutorials. X-Git-Tag: v8.5.0-rc1~34^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4071%2Fhead;p=dealii.git Improve exception handling in two tutorials. These were caught by Coverity. --- diff --git a/examples/step-49/step-49.cc b/examples/step-49/step-49.cc index eeeb60cd37..b884ea8c6c 100644 --- a/examples/step-49/step-49.cc +++ b/examples/step-49/step-49.cc @@ -350,11 +350,38 @@ void grid_7() // subfunctions. int main () { - grid_1 (); - grid_2 (); - grid_3 (); - grid_4 (); - grid_5 (); - grid_6 (); - grid_7 (); + try + { + grid_1 (); + grid_2 (); + grid_3 (); + grid_4 (); + grid_5 (); + grid_6 (); + grid_7 (); + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + } } diff --git a/examples/step-50/step-50.cc b/examples/step-50/step-50.cc index bff72b2018..69119e34ba 100644 --- a/examples/step-50/step-50.cc +++ b/examples/step-50/step-50.cc @@ -989,7 +989,6 @@ int main (int argc, char *argv[]) << "Aborting!" << std::endl << "----------------------------------------------------" << std::endl; - throw; } catch (...) {