From c8458ab39728eda235086cb35f3e0ba4281ee084 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 7 Nov 2011 00:50:03 +0100 Subject: [PATCH] improved diagnostics --- src/include/logging.h | 3 +++ src/lib/error.hpp | 21 +++++++++++++++++++++ src/proc/engine/buffer-metadata.hpp | 14 +------------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/include/logging.h b/src/include/logging.h index e2b9455ea..6fd024b97 100644 --- a/src/include/logging.h +++ b/src/include/logging.h @@ -90,6 +90,9 @@ NOBUG_CPP_DEFINE_FLAG_PARENT ( fileheader_dbg, backend_dbg); /** base of debug logging for the proc layer */ NOBUG_CPP_DEFINE_FLAG_PARENT ( proc_dbg, debugging); NOBUG_CPP_DEFINE_FLAG_PARENT ( command_dbg, proc_dbg); +NOBUG_CPP_DEFINE_FLAG_PARENT ( session_dbg, proc_dbg); +NOBUG_CPP_DEFINE_FLAG_PARENT ( player_dbg, proc_dbg); +NOBUG_CPP_DEFINE_FLAG_PARENT ( engine_dbg, proc_dbg); /** base of debug logging for the gui */ NOBUG_CPP_DEFINE_FLAG_PARENT ( gui_dbg, debugging); /** base if debug logging for the support library */ diff --git a/src/lib/error.hpp b/src/lib/error.hpp index 5e2427e0a..110ffe61b 100644 --- a/src/lib/error.hpp +++ b/src/lib/error.hpp @@ -215,6 +215,27 @@ namespace lumiera { } // namespace lumiera +/****************************************************** + * convenience shortcut for a sequence of catch blocks + * just logging and consuming an error. Typically + * this sequence will be used within destructors, + * which, by convention, must not throw + */ +#define ERROR_LOG_AND_IGNORE(_FLAG_,_OP_DESCR_) \ + catch (std::exception& problem) \ + { \ + const char* errID = lumiera_error(); \ + WARN (_FLAG_, "%s failed: %s", _OP_DESCR_, problem.what()); \ + TRACE (debugging, "Error flag was: %s", errID);\ + } \ + catch (...) \ + { \ + const char* errID = lumiera_error(); \ + ERROR (_FLAG_, "%s failed with unknown exception; " \ + "error flag is: %s" \ + , _OP_DESCR_, errID); \ + } + /****************************************************** diff --git a/src/proc/engine/buffer-metadata.hpp b/src/proc/engine/buffer-metadata.hpp index 9a73ba20a..57420fe7f 100644 --- a/src/proc/engine/buffer-metadata.hpp +++ b/src/proc/engine/buffer-metadata.hpp @@ -635,19 +635,7 @@ namespace engine { { for_each (entries_, verify_is_free); } - catch (std::exception& problem) - { - const char* errID = lumiera_error(); - const char* operation = "Shutdown of BufferProvider metadata store"; - WARN (engine, "%s failed: %s", operation, problem.what()); - TRACE (debugging, "Error flag was: %s", errID); - } - catch (...) - { - const char* errID = lumiera_error(); - const char* operation = "Shutdown of BufferProvider metadata store"; - ERROR (engine, "%s failed with unknown exception; error flag is: %s", operation, errID); - } + ERROR_LOG_AND_IGNORE (engine,"Shutdown of BufferProvider metadata store") static void verify_is_free (std::pair const& e)