From b6c617c3d69d6b2cf209bd7cfe4b9565b58e87c0 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 21 Apr 2023 12:14:01 +0200 Subject: [PATCH] use more TOOLS_WARN_EXCEPTION so we get more complete information when something goes wrong Change-Id: Ia73623f748b0779cf80b0086bd8258791590e9ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150754 Tested-by: Jenkins Reviewed-by: Noel Grandin --- comphelper/source/misc/storagehelper.cxx | 3 ++- connectivity/source/drivers/postgresql/pq_xcontainer.cxx | 5 +++-- sc/source/ui/view/drawvie4.cxx | 3 ++- sfx2/source/appl/appmisc.cxx | 3 ++- sfx2/source/sidebar/ContextChangeBroadcaster.cxx | 3 ++- svx/source/svdraw/charthelper.cxx | 2 +- toolkit/source/controls/dialogcontrol.cxx | 2 +- writerfilter/source/dmapper/SdtHelper.cxx | 4 +++- xmloff/source/style/xmlexppr.cxx | 5 +++-- xmloff/source/text/XMLTextMarkImportContext.cxx | 3 ++- 10 files changed, 21 insertions(+), 12 deletions(-) diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index 8244a1a1654a..9d3dbcd22732 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -50,6 +50,7 @@ #include #include +#include #include #include #include @@ -388,7 +389,7 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreatePackageEncryptionData( } catch ( uno::Exception& ) { - OSL_ENSURE( false, "Can not create SHA256 digest!" ); + TOOLS_WARN_EXCEPTION("comphelper", "Can not create SHA256 digest!" ); } // MS_1252 encoding was used for SO60 document format password encoding, diff --git a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx index 5c0567b2dc3a..9d594280065d 100644 --- a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx +++ b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -392,13 +393,13 @@ void Container::fire( const EventBroadcastHelper &helper ) } catch ( css::uno::RuntimeException & ) { - OSL_ENSURE( false, "exception caught" ); + TOOLS_WARN_EXCEPTION( "connectivity.postgresql", "exception caught" ); // loose coupling, a runtime exception shall not break anything // TODO: log away as warning ! } catch( css::uno::Exception & ) { - OSL_ENSURE( false, "exception from listener flying through" ); + TOOLS_WARN_EXCEPTION( "connectivity.postgresql", "exception from listener flying through" ); throw; } } diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index f720ecd76d33..5cc1655b83c4 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -50,6 +50,7 @@ #include #include #include +#include using namespace com::sun::star; @@ -468,7 +469,7 @@ void ScDrawView::SetMarkedOriginalSize() bDo = true; } catch( embed::NoVisualAreaSizeException& ) { - OSL_ENSURE( false, "Can't get the original size of the object!" ); + TOOLS_WARN_EXCEPTION("sc.ui", "Can't get the original size of the object!" ); } } } diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index dc1f26a969b3..3b748ddebd04 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -194,7 +195,7 @@ bool SfxApplication::loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWid } catch(const uno::Exception&) { - OSL_ENSURE(false, "Got no graphic::XPrimitive2DRenderer (!)" ); + TOOLS_WARN_EXCEPTION("sfx.appl", "Got no graphic::XPrimitive2DRenderer (!)" ); } return false; } diff --git a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx index d2d55b700fbc..4c1cf2c16a6d 100644 --- a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx +++ b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -116,7 +117,7 @@ OUString ContextChangeBroadcaster::GetModuleName (const css::uno::Reference #include #include +#include #include #include #include @@ -388,7 +389,8 @@ void SdtHelper::createDateContentControl() } catch (uno::Exception&) { - OSL_ENSURE(false, "Cannot get the right text range for date field"); + TOOLS_WARN_EXCEPTION("writerfilter.dmapper", + "Cannot get the right text range for date field"); return; } diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx index 31064b26ee49..ee1600da27d6 100644 --- a/xmloff/source/style/xmlexppr.cxx +++ b/xmloff/source/style/xmlexppr.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -438,7 +439,7 @@ void FilterPropertiesInfo_Impl::FillPropertyStateArray( catch( UnknownPropertyException& ) { // might be a problem of getImplementationId - OSL_ENSURE( false, "unknown property in getPropertyValue" ); + TOOLS_WARN_EXCEPTION("xmloff.style", "unknown property in getPropertyValue" ); } } @@ -644,7 +645,7 @@ std::vector SvXMLExportPropertyMapper::Filter_( catch( UnknownPropertyException& ) { // might be a problem of getImplementationId - OSL_ENSURE( false, "unknown property in getPropertyStates" ); + TOOLS_WARN_EXCEPTION("xmloff.style", "unknown property in getPropertyStates" ); } } diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx index 4a71194df23c..bdae5f16c8d6 100644 --- a/xmloff/source/text/XMLTextMarkImportContext.cxx +++ b/xmloff/source/text/XMLTextMarkImportContext.cxx @@ -42,6 +42,7 @@ #include #include +#include #include @@ -384,7 +385,7 @@ void XMLTextMarkImportContext::endFastElement(sal_Int32 nElement) try { xInsertionCursor->gotoRange(xStartRange, true); } catch (uno::Exception&) { - OSL_ENSURE(false, + TOOLS_WARN_EXCEPTION("xmloff.text", "cannot go to end position of bookmark"); }