diff options
author | Eike Rathke <erack@redhat.com> | 2016-11-25 16:13:03 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-11-25 16:26:42 +0100 |
commit | 6c60aa313c0598d9136f0bf6e2adc60654fc28d0 (patch) | |
tree | 6b923a9ef73c5eba8694e8dcaaf3dffaae573147 | |
parent | 9d2f30911de2f9d87cebb1a360fabe0bf9c05294 (diff) |
introduce DBG_UNHANDLED_EXCEPTION_WHEN for calls with an explanatory message
Change-Id: Ic80f2ed2c0fdff20d1ee1968bec2840bf914fb5e
-rw-r--r-- | include/tools/diagnose_ex.h | 8 | ||||
-rw-r--r-- | tools/source/debug/debug.cxx | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/include/tools/diagnose_ex.h b/include/tools/diagnose_ex.h index bd0ec8818ba9..b3db8eb4986c 100644 --- a/include/tools/diagnose_ex.h +++ b/include/tools/diagnose_ex.h @@ -27,7 +27,9 @@ #include <tools/toolsdllapi.h> -TOOLS_DLLPUBLIC void DbgUnhandledException(const css::uno::Any& caughtException, const char* currentFunction, const char* fileAndLineNo); +TOOLS_DLLPUBLIC void DbgUnhandledException(const css::uno::Any& caughtException, + const char* currentFunction, const char* fileAndLineNo, + const char* explanatory = nullptr); #if OSL_DEBUG_LEVEL > 0 #include <com/sun/star/configuration/CorruptedConfigurationException.hpp> @@ -43,8 +45,12 @@ TOOLS_DLLPUBLIC void DbgUnhandledException(const css::uno::Any& caughtException, #define DBG_UNHANDLED_EXCEPTION() \ DbgUnhandledException( ::cppu::getCaughtException(), OSL_THIS_FUNC, SAL_DETAIL_WHERE); + #define DBG_UNHANDLED_EXCEPTION_WHEN(explain) \ + DbgUnhandledException( ::cppu::getCaughtException(), OSL_THIS_FUNC, SAL_DETAIL_WHERE, explain); + #else // OSL_DEBUG_LEVEL #define DBG_UNHANDLED_EXCEPTION() + #define DBG_UNHANDLED_EXCEPTION_WHEN(explain) #endif // OSL_DEBUG_LEVEL /** This macro asserts the given condition (in debug mode), and throws diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx index 1f67a6fa946c..65850ce0b129 100644 --- a/tools/source/debug/debug.cxx +++ b/tools/source/debug/debug.cxx @@ -76,10 +76,16 @@ void DbgTestSolarMutex() #endif -void DbgUnhandledException(const css::uno::Any & caught, const char* currentFunction, const char* fileAndLineNo) +void DbgUnhandledException(const css::uno::Any & caught, const char* currentFunction, const char* fileAndLineNo, + const char* explanatory) { OString sMessage( "DBG_UNHANDLED_EXCEPTION in " ); sMessage += currentFunction; + if (explanatory) + { + sMessage += "\n when: "; + sMessage += explanatory; + } sMessage += "\n type: "; sMessage += OUStringToOString( caught.getValueTypeName(), osl_getThreadTextEncoding() ); css::uno::Exception exception; |