getfem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-commits] (no subject)


From: Yves Renard
Subject: [Getfem-commits] (no subject)
Date: Fri, 14 Jul 2017 01:37:44 -0400 (EDT)

branch: master
commit 1398d2a7cce130422693296faf07f23555238c71
Author: rpplx <address@hidden>
Date:   Wed Jul 12 23:13:03 2017 +0200

    Introducing the feedback handling menager to GMM_STANDARD_CATCH_ERROR.
---
 src/gmm/gmm_except.h | 133 ++++++++++++++++++++++++++++++++-------------------
 1 file changed, 83 insertions(+), 50 deletions(-)

diff --git a/src/gmm/gmm_except.h b/src/gmm/gmm_except.h
index 4536c4b..cbddf28 100644
--- a/src/gmm/gmm_except.h
+++ b/src/gmm/gmm_except.h
@@ -302,56 +302,89 @@ namespace gmm {
 # define GMM_SIMPLE_TRACE4(thestr) {}
 #endif
 
-
-  /* ********************************************************************* */
-  /*    Definitions for compatibility with old versions.                   */
-  /* ********************************************************************* */
-
-#define GMM_STANDARD_CATCH_ERROR   catch(std::logic_error e)                \
-    {                                                                       \
-      std::cerr << "============================================\n";        \
-      std::cerr << "|      An error has been detected !!!      |\n";        \
-      std::cerr << "============================================\n";        \
-      std::cerr << e.what() << std::endl << std::endl;                      \
-      exit(1);                                                              \
-    }                                                                       \
-  catch(const std::runtime_error &e)                                        \
-    {                                                                       \
-      std::cerr << "============================================\n";        \
-      std::cerr << "|      An error has been detected !!!      |\n";        \
-      std::cerr << "============================================\n";        \
-      std::cerr << e.what() << std::endl << std::endl;                      \
-      exit(1);                                                              \
-    }                                                                       \
-  catch(const std::bad_alloc &) {                                           \
-    std::cerr << "============================================\n";          \
-    std::cerr << "|  A bad allocation has been detected !!!  |\n";          \
-    std::cerr << "============================================\n";          \
-    exit(1);                                                                \
-  }                                                                         \
-  catch(const std::bad_typeid &) {                                          \
-    std::cerr << "============================================\n";          \
-    std::cerr << "|  A bad typeid     has been detected !!!  |\n";          \
-    std::cerr << "============================================\n";          \
-    exit(1);                                                                \
-  }                                                                         \
-  catch(const std::bad_exception &) {                                       \
-    std::cerr << "============================================\n";          \
-    std::cerr << "|  A bad exception  has been detected !!!  |\n";          \
-    std::cerr << "============================================\n";          \
-    exit(1);                                                                \
-  }                                                                         \
-  catch(const std::bad_cast &) {                                            \
-    std::cerr << "============================================\n";          \
-    std::cerr << "|    A bad cast  has been detected !!!     |\n";          \
-    std::cerr << "============================================\n";          \
-    exit(1);                                                                \
-  }                                                                         \
-  catch(...) {                                                              \
-    std::cerr << "============================================\n";          \
-    std::cerr << "|  An unknown error has been detected !!!  |\n";          \
-    std::cerr << "============================================\n";          \
-    exit(1);                                                                \
+#define GMM_STANDARD_CATCH_ERROR                                           \
+  catch(gmm::gmm_error e)                                                  \
+  {                                                                        \
+    std::stringstream strStream;                                           \
+    strStream << "============================================\n";         \
+    strStream << "|    A GMM error has been detected !!!     |\n";         \
+    strStream << "============================================\n";         \
+    strStream << e.what() << std::endl << std::endl;                       \
+    gmm::feedback_manager::send(strStream.str(),                           \
+                               gmm::FeedbackType::ASSERT, e.errLevel());   \
+    gmm::feedback_manager::terminating_action();                           \
+  }                                                                        \
+  catch(std::logic_error e)                                                \
+  {                                                                        \
+    std::stringstream strStream;                                           \
+    strStream << "============================================\n";         \
+    strStream << "|       An error has been detected !!!     |\n";         \
+    strStream << "============================================\n";         \
+    strStream << e.what() << std::endl << std::endl;                       \
+    gmm::feedback_manager::send(strStream.str(),                           \
+                               gmm::FeedbackType::ASSERT, 0);              \
+    gmm::feedback_manager::terminating_action();                           \
+  }                                                                        \
+  catch(std::runtime_error e)                                              \
+  {                                                                        \
+    std::stringstream strStream;                                           \
+    strStream << "============================================\n";         \
+    strStream << "| A runtime error has been detected !!!    |\n";         \
+    strStream << "============================================\n";         \
+    strStream << e.what() << std::endl << std::endl;                       \
+    gmm::feedback_manager::send(strStream.str(),                           \
+                               gmm::FeedbackType::ASSERT, 0);              \
+    gmm::feedback_manager::terminating_action();                           \
+  }                                                                        \
+  catch(std::bad_alloc)                                                    \
+  {                                                                        \
+    std::stringstream strStream;                                           \
+    strStream << "============================================\n";         \
+    strStream << "| A bad allocation has been detected !!!   |\n";         \
+    strStream << "============================================\n";         \
+    gmm::feedback_manager::send(strStream.str(),                           \
+                               gmm::FeedbackType::ASSERT, 0);              \
+    gmm::feedback_manager::terminating_action();                           \
+  }                                                                        \
+  catch(std::bad_typeid)                                                   \
+  {                                                                        \
+    std::stringstream strStream;                                           \
+    strStream << "============================================\n";         \
+    strStream << "|  A bad typeid has been detected !!!      |\n";         \
+    strStream << "============================================\n";         \
+    gmm::feedback_manager::send(strStream.str(),                           \
+                               gmm::FeedbackType::ASSERT, 0);              \
+    gmm::feedback_manager::terminating_action();                           \
+  }                                                                        \
+  catch(std::bad_exception)                                                \
+  {                                                                        \
+    std::stringstream strStream;                                           \
+    strStream << "============================================\n";         \
+    strStream << "|  A bad exception has been detected !!!   |\n";         \
+    strStream << "============================================\n";         \
+    gmm::feedback_manager::send(strStream.str(),                           \
+                               gmm::FeedbackType::ASSERT, 0);              \
+    gmm::feedback_manager::terminating_action();                           \
+  }                                                                        \
+  catch(std::bad_cast)                                                     \
+  {                                                                        \
+    std::stringstream strStream;                                           \
+    strStream << "============================================\n";         \
+    strStream << "|      A bad_cast has been detected !!!    |\n";         \
+    strStream << "============================================\n";         \
+    gmm::feedback_manager::send(strStream.str(),                           \
+                               gmm::FeedbackType::ASSERT, 0);              \
+    gmm::feedback_manager::terminating_action();                           \
+  }                                                                        \
+  catch(...)                                                               \
+  {                                                                        \
+    std::stringstream strStream;                                           \
+    strStream << "============================================\n";         \
+    strStream << "|  An unknown error has been detected !!!  |\n";         \
+    strStream << "============================================\n";         \
+    gmm::feedback_manager::send(strStream.str(),                           \
+                               gmm::FeedbackType::ASSERT, 0);              \
+    gmm::feedback_manager::terminating_action();                           \
   }
   //   catch(ios_base::failure) {
   //     std::cerr << "============================================\n";



reply via email to

[Prev in Thread] Current Thread [Next in Thread]