include/tools/diagnose_ex.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
New commits: commit 6ed829ab3b6233acfb1a7b5ec3412cf5a56ef8f2 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Jun 13 11:56:46 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Jun 14 09:10:48 2019 +0200 add TOOLS_WARN_EXCEPTION,etc macros to be used for nicer logging of exceptions, along with upcoming clang plugin Change-Id: I028c31ec329652e4842136528605b4cceaae946d Reviewed-on: https://gerrit.libreoffice.org/73949 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> 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: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits