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(-)

New commits:
commit b6c617c3d69d6b2cf209bd7cfe4b9565b58e87c0
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Apr 21 12:14:01 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Apr 23 13:35:46 2023 +0200

    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 <noel.gran...@collabora.co.uk>

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 <ucbhelper/content.hxx>
 
 #include <comphelper/bytereader.hxx>
+#include <comphelper/diagnose_ex.hxx>
 #include <comphelper/fileformat.h>
 #include <comphelper/hash.hxx>
 #include <comphelper/processfactory.hxx>
@@ -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 <com/sun/star/container/ElementExistException.hpp>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <comphelper/diagnose_ex.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <o3tl/safeint.hxx>
 #include <utility>
@@ -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 <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
 #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
 #include <com/sun/star/chart2/XChartDocument.hpp>
+#include <comphelper/diagnose_ex.hxx>
 
 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 <com/sun/star/graphic/Primitive2DTools.hpp>
 #include <com/sun/star/uno/Reference.h>
 #include <unotools/configmgr.hxx>
+#include <comphelper/diagnose_ex.hxx>
 #include <comphelper/processfactory.hxx>
 #include <osl/diagnose.h>
 #include <rtl/bootstrap.hxx>
@@ -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 <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
 #include <com/sun/star/frame/ModuleManager.hpp>
 #include <osl/diagnose.h>
+#include <comphelper/diagnose_ex.hxx>
 #include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
 #include <sfx2/lokhelper.hxx>
@@ -116,7 +117,7 @@ OUString ContextChangeBroadcaster::GetModuleName (const 
css::uno::Reference<css:
     }
     catch (const Exception&)
     {
-        OSL_ENSURE(false, "can not determine module name");
+        TOOLS_WARN_EXCEPTION("sfx.sidebar", "can not determine module name");
     }
     return OUString();
 }
diff --git a/svx/source/svdraw/charthelper.cxx 
b/svx/source/svdraw/charthelper.cxx
index 4a50b07783ab..2c75be5d27d6 100644
--- a/svx/source/svdraw/charthelper.cxx
+++ b/svx/source/svdraw/charthelper.cxx
@@ -91,7 +91,7 @@ drawinglayer::primitive2d::Primitive2DContainer 
ChartHelper::tryToGetChartConten
     }
     catch(uno::Exception&)
     {
-        OSL_ENSURE(false, "Unexpected exception!");
+        TOOLS_WARN_EXCEPTION("svx", "");
     }
 
     if(!aRetval.empty())
diff --git a/toolkit/source/controls/dialogcontrol.cxx 
b/toolkit/source/controls/dialogcontrol.cxx
index 1b3e7d988ffa..dffc0111b6ef 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -292,7 +292,7 @@ void 
UnoControlDialogModel::setFastPropertyValue_NoBroadcast( std::unique_lock<s
     }
     catch( const css::uno::Exception& )
     {
-        OSL_ENSURE( false, 
"UnoControlDialogModel::setFastPropertyValue_NoBroadcast: caught an exception 
while setting ImageURL properties!" );
+        TOOLS_WARN_EXCEPTION( "toolkit", "caught an exception while setting 
ImageURL properties" );
     }
 }
 
diff --git a/writerfilter/source/dmapper/SdtHelper.cxx 
b/writerfilter/source/dmapper/SdtHelper.cxx
index f7642c464889..ce2cb3e9b136 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -16,6 +16,7 @@
 #include <utility>
 #include <vcl/svapp.hxx>
 #include <vcl/outdev.hxx>
+#include <comphelper/diagnose_ex.hxx>
 #include <comphelper/string.hxx>
 #include <comphelper/sequence.hxx>
 #include <xmloff/odffields.hxx>
@@ -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 <com/sun/star/beans/TolerantPropertySetResultType.hpp>
 #include <rtl/ustrbuf.hxx>
 #include <comphelper/anycompare.hxx>
+#include <comphelper/diagnose_ex.hxx>
 #include <cppuhelper/weakref.hxx>
 #include <osl/diagnose.h>
 #include <list>
@@ -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<XMLPropertyState> 
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 <com/sun/star/rdf/XMetadatable.hpp>
 
 #include <com/sun/star/text/XFormField.hpp>
+#include <comphelper/diagnose_ex.hxx>
 
 #include <RDFaImportHelper.hxx>
 
@@ -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");
                     }
 

Reply via email to