From 43daf9bbab1e86ae854c001081bdbb9d5b933017 Mon Sep 17 00:00:00 2001 From: heister Date: Fri, 15 Feb 2013 05:08:26 +0000 Subject: [PATCH] for regression tests: if abort() is disabled in assert(), throw the exception instead of ignoring it. This allows us to properly test for failing conditions. This commit will break a couple of tests that need to be adapted by hand. git-svn-id: https://svn.dealii.org/trunk@28399 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/base/exceptions.h | 4 +++- deal.II/source/base/exceptions.cc | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/deal.II/include/deal.II/base/exceptions.h b/deal.II/include/deal.II/base/exceptions.h index 822a0f7fe7..5ef1d87a26 100644 --- a/deal.II/include/deal.II/base/exceptions.h +++ b/deal.II/include/deal.II/base/exceptions.h @@ -192,7 +192,9 @@ namespace deal_II_exceptions /** * Calling this function switches off the use of std::abort() when an - * exception is created using the Assert() macro. Generally, you want + * exception is created using the Assert() macro. Instead, the Exception + * will be thrown using 'throw', so it can be caught if desired. + * Generally, you want * to abort the execution of a program when Assert() is called, but it * needs to be switched off if you want to log all exceptions created, * or if you want to test if an assertion is working correctly. This is diff --git a/deal.II/source/base/exceptions.cc b/deal.II/source/base/exceptions.cc index 63bc7dd9ae..90367a2cd8 100644 --- a/deal.II/source/base/exceptions.cc +++ b/deal.II/source/base/exceptions.cc @@ -428,7 +428,10 @@ namespace deal_II_exceptions else if (deal_II_exceptions::abort_on_exception == true) std::abort (); else - --n_treated_exceptions; + { + --n_treated_exceptions; + throw e; + } } -- 2.39.5