From 162017cd9abd9c1ca63a6b671a084464b896e85c Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sat, 22 Jan 2022 18:20:05 +0100 Subject: Improve DBG_UNHANDLED_EXCEPTION output a bit For example, in de3898aecb11307789644a1814e9cbb1ee4cc29b "Add missing test dependency" it would have output > warn:svx:680849:680849:svx/source/unodraw/unoshape.cxx:1779: DBG_UNHANDLED_EXCEPTION in setPropertyValues exception: com.sun.star.beans.UnknownPropertyException message: "URL at svx/source/unodraw/unoshape.cxx:1600" rather than > warn:svx:680849:680849:svx/source/unodraw/unoshape.cxx:1779: DBG_UNHANDLED_EXCEPTION in setPropertyValues exception: com.sun.star.beans.UnknownPropertyException message: URL svx/source/unodraw/unoshape.cxx:1600 making it slightly clearer that what follows "URL" is not the value of that URL but rather the source location where the exception was thrown. Change-Id: Ia3abd232fce3d95a8b66ff4ed5bab2fcc248df2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128788 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- codemaker/source/cppumaker/cpputype.cxx | 4 ++-- tools/source/debug/debug.cxx | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index dab77fa42292..d64c79a36c2c 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -2871,7 +2871,7 @@ void ExceptionType::dumpHppFile( out << "\n#if defined LIBO_USE_SOURCE_LOCATION\n"; out << " if (!Message.isEmpty())\n"; out << " Message += \" \";\n"; - out << " Message += o3tl::runtimeToOUString(location.file_name()) + \":\" + OUString::number(location.line());\n"; + out << " Message += \"at \" + o3tl::runtimeToOUString(location.file_name()) + \":\" + OUString::number(location.line());\n"; out << "#endif\n"; } out << "}\n\n"; @@ -2924,7 +2924,7 @@ void ExceptionType::dumpHppFile( out << "\n#if defined LIBO_USE_SOURCE_LOCATION\n"; out << " if (!Message.isEmpty())\n"; out << " Message += \" \";\n"; - out << " Message += o3tl::runtimeToOUString(location.file_name()) + \":\" + OUString::number(location.line());\n"; + out << " Message += \"at \" + o3tl::runtimeToOUString(location.file_name()) + \":\" + OUString::number(location.line());\n"; out << "#endif\n"; } out << "}\n\n"; diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx index 82406a3624ff..167bd95639ec 100644 --- a/tools/source/debug/debug.cxx +++ b/tools/source/debug/debug.cxx @@ -105,8 +105,9 @@ static void exceptionToStringImpl(OStringBuffer& sMessage, const css::uno::Any & caught >>= exception; if ( !exception.Message.isEmpty() ) { - sMessage.append(" message: "); + sMessage.append(" message: \""); sMessage.append(toOString(exception.Message)); + sMessage.append("\""); } /* TODO FIXME (see https://gerrit.libreoffice.org/#/c/83245/) if ( exception.Context.is() ) -- cgit