summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/tools/diagnose_ex.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/tools/diagnose_ex.h b/include/tools/diagnose_ex.h
index 596e44c4694d..d37b7e99b368 100644
--- a/include/tools/diagnose_ex.h
+++ b/include/tools/diagnose_ex.h
@@ -133,6 +133,36 @@ inline css::uno::Any DbgGetCaughtException()
*/
TOOLS_DLLPUBLIC OString exceptionToString(css::uno::Any const & caughtEx);
+/**
+ Logs an message along with a nicely formatted version of the current exception.
+ This must be called as the FIRST thing in a catch block.
+*/
+#define TOOLS_WARN_EXCEPTION(area, stream) \
+ do { \
+ css::uno::Any tools_warn_exception( cppu::getCaughtException() ); \
+ SAL_WARN(area, stream << " " << exceptionToString(tools_warn_exception)); \
+ } while (false)
+
+/**
+ Logs an message along with a nicely formatted version of the current exception.
+ This must be called as the FIRST thing in a catch block.
+*/
+#define TOOLS_WARN_EXCEPTION_IF(cond, area, stream) \
+ do { \
+ css::uno::Any tools_warn_exception( cppu::getCaughtException() ); \
+ SAL_WARN_IF(cond, area, stream << " " << exceptionToString(tools_warn_exception)); \
+ } while (false)
+
+/**
+ Logs an message along with a nicely formatted version of the current exception.
+ This must be called as the FIRST thing in a catch block.
+*/
+#define TOOLS_INFO_EXCEPTION(area, stream) \
+ do { \
+ css::uno::Any tools_warn_exception( cppu::getCaughtException() ); \
+ SAL_WARN(area, stream << " " << exceptionToString(tools_warn_exception)); \
+ } while (false)
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */