summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-03-01 14:42:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-03-07 07:12:39 +0100
commit8b5e23eac31cafbd442a3acab5fbcf98bfd0af11 (patch)
treed41feeea533127280e0503d0dc2dd55a4ab83ce8 /unotools
parent4f810905fa74128871f2fe924a3d28a79f4e4261 (diff)
log nice exception messages whereever possible
Change-Id: Idd125c18bee1a39b9ea8cc4f8c55cddfd37c33e1 Reviewed-on: https://gerrit.libreoffice.org/68579 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/itemholder1.cxx6
-rw-r--r--unotools/source/config/viewoptions.cxx74
2 files changed, 47 insertions, 33 deletions
diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx
index 70d1880ca6ca..bf74770f34a2 100644
--- a/unotools/source/config/itemholder1.cxx
+++ b/unotools/source/config/itemholder1.cxx
@@ -47,6 +47,7 @@
#include <unotools/syslocaleoptions.hxx>
#include <sal/log.hxx>
#include <osl/diagnose.h>
+#include <tools/diagnose_ex.h>
ItemHolder1::ItemHolder1()
: ItemHolderMutexBase()
@@ -60,13 +61,14 @@ ItemHolder1::ItemHolder1()
xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this));
}
#ifdef DBG_UTIL
- catch(const css::uno::Exception& rEx)
+ catch(const css::uno::Exception&)
{
static bool bMessage = true;
if(bMessage)
{
bMessage = false;
- SAL_WARN( "unotools", "CreateInstance with arguments exception: " << rEx);
+ css::uno::Any ex( cppu::getCaughtException() );
+ SAL_WARN( "unotools", "CreateInstance with arguments exception: " << exceptionToString(ex));
}
}
#else
diff --git a/unotools/source/config/viewoptions.cxx b/unotools/source/config/viewoptions.cxx
index 25d8d21f7ecf..ae5eb752bbff 100644
--- a/unotools/source/config/viewoptions.cxx
+++ b/unotools/source/config/viewoptions.cxx
@@ -32,6 +32,7 @@
#include <unotools/configmgr.hxx>
#include <comphelper/configurationhelper.hxx>
#include <comphelper/processfactory.hxx>
+#include <tools/diagnose_ex.h>
#include "itemholder1.hxx"
@@ -58,9 +59,6 @@
}
#endif // DEBUG_VIEWOPTIONS
-#define SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) \
- SAL_WARN("unotools", "Unexpected exception caught. Original message was: " << ex.Message);
-
// initialization!
SvtViewOptionsBase_Impl* SvtViewOptions::m_pDataContainer_Dialogs = nullptr ;
@@ -160,12 +158,13 @@ SvtViewOptionsBase_Impl::SvtViewOptionsBase_Impl( const OUString& sList )
if (m_xRoot.is())
m_xRoot->getByName(sList) >>= m_xSet;
}
- catch(const css::uno::Exception& ex)
+ catch(const css::uno::Exception&)
{
+ css::uno::Any ex( cppu::getCaughtException() );
m_xRoot.clear();
m_xSet.clear();
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
+ SAL_WARN("unotools", "Unexpected exception caught. " << exceptionToString(ex));
}
}
@@ -214,10 +213,11 @@ bool SvtViewOptionsBase_Impl::Exists( const OUString& sName )
if (m_xSet.is())
bExists = m_xSet->hasByName(sName);
}
- catch(const css::uno::Exception& ex)
+ catch(const css::uno::Exception&)
{
+ css::uno::Any ex( cppu::getCaughtException() );
bExists = false;
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
+ SAL_WARN("unotools", "Unexpected exception caught. " << exceptionToString(ex));
}
return bExists;
@@ -245,9 +245,10 @@ void SvtViewOptionsBase_Impl::Delete( const OUString& sName )
}
catch(const css::container::NoSuchElementException&)
{ }
- catch(const css::uno::Exception& ex)
+ catch(const css::uno::Exception&)
{
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
+ css::uno::Any ex( cppu::getCaughtException() );
+ SAL_WARN("unotools", "Unexpected exception caught. " << exceptionToString(ex));
}
}
@@ -272,10 +273,11 @@ OUString SvtViewOptionsBase_Impl::GetWindowState( const OUString& sName )
if (xNode.is())
xNode->getPropertyValue(PROPERTY_WINDOWSTATE) >>= sWindowState;
}
- catch(const css::uno::Exception& ex)
+ catch(const css::uno::Exception&)
{
+ css::uno::Any ex( cppu::getCaughtException() );
sWindowState.clear();
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
+ SAL_WARN("unotools", "Unexpected exception caught. " << exceptionToString(ex));
}
return sWindowState;
@@ -296,9 +298,10 @@ void SvtViewOptionsBase_Impl::SetWindowState( const OUString& sName ,
xNode->setPropertyValue(PROPERTY_WINDOWSTATE, css::uno::makeAny(sState));
::comphelper::ConfigurationHelper::flush(m_xRoot);
}
- catch(const css::uno::Exception& ex)
+ catch(const css::uno::Exception&)
{
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
+ css::uno::Any ex( cppu::getCaughtException() );
+ SAL_WARN("unotools", "Unexpected exception caught. " << exceptionToString(ex));
}
}
@@ -333,9 +336,10 @@ css::uno::Sequence< css::beans::NamedValue > SvtViewOptionsBase_Impl::GetUserDat
return lUserData;
}
}
- catch(const css::uno::Exception& ex)
+ catch(const css::uno::Exception&)
{
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
+ css::uno::Any ex( cppu::getCaughtException() );
+ SAL_WARN("unotools", "Unexpected exception caught. " << exceptionToString(ex));
}
return css::uno::Sequence< css::beans::NamedValue >();
@@ -370,9 +374,10 @@ void SvtViewOptionsBase_Impl::SetUserData( const OUString&
}
::comphelper::ConfigurationHelper::flush(m_xRoot);
}
- catch(const css::uno::Exception& ex)
+ catch(const css::uno::Exception&)
{
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
+ css::uno::Any ex( cppu::getCaughtException() );
+ SAL_WARN("unotools", "Unexpected exception caught. " << exceptionToString(ex));
}
}
@@ -397,10 +402,11 @@ css::uno::Any SvtViewOptionsBase_Impl::GetUserItem( const OUString& sName ,
}
catch(const css::container::NoSuchElementException&)
{ aItem.clear(); }
- catch(const css::uno::Exception& ex)
+ catch(const css::uno::Exception&)
{
+ css::uno::Any ex( cppu::getCaughtException() );
aItem.clear();
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
+ SAL_WARN("unotools", "Unexpected exception caught. " << exceptionToString(ex));
}
return aItem;
@@ -430,9 +436,10 @@ void SvtViewOptionsBase_Impl::SetUserItem( const OUString& sName ,
}
::comphelper::ConfigurationHelper::flush(m_xRoot);
}
- catch(const css::uno::Exception& ex)
+ catch(const css::uno::Exception&)
{
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
+ css::uno::Any ex( cppu::getCaughtException() );
+ SAL_WARN("unotools", "Unexpected exception caught. " << exceptionToString(ex));
}
}
@@ -451,9 +458,10 @@ OString SvtViewOptionsBase_Impl::GetPageID( const OUString& sName )
if (xNode.is())
xNode->getPropertyValue(PROPERTY_PAGEID) >>= sID;
}
- catch(const css::uno::Exception& ex)
+ catch(const css::uno::Exception&)
{
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
+ css::uno::Any ex( cppu::getCaughtException() );
+ SAL_WARN("unotools", "Unexpected exception caught. " << exceptionToString(ex));
}
return sID.toUtf8();
@@ -474,9 +482,10 @@ void SvtViewOptionsBase_Impl::SetPageID( const OUString& sName ,
xNode->setPropertyValue(PROPERTY_PAGEID, css::uno::makeAny(OUString::fromUtf8(sID)));
::comphelper::ConfigurationHelper::flush(m_xRoot);
}
- catch(const css::uno::Exception& ex)
+ catch(const css::uno::Exception&)
{
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
+ css::uno::Any ex( cppu::getCaughtException() );
+ SAL_WARN("unotools", "Unexpected exception caught. " << exceptionToString(ex));
}
}
@@ -501,9 +510,10 @@ SvtViewOptionsBase_Impl::State SvtViewOptionsBase_Impl::GetVisible( const OUStri
}
}
}
- catch(const css::uno::Exception& ex)
+ catch(const css::uno::Exception&)
{
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
+ css::uno::Any ex( cppu::getCaughtException() );
+ SAL_WARN("unotools", "Unexpected exception caught. " << exceptionToString(ex));
}
return eState;
@@ -524,9 +534,10 @@ void SvtViewOptionsBase_Impl::SetVisible( const OUString& sName ,
xNode->setPropertyValue(PROPERTY_VISIBLE, css::uno::makeAny(bVisible));
::comphelper::ConfigurationHelper::flush(m_xRoot);
}
- catch(const css::uno::Exception& ex)
+ catch(const css::uno::Exception&)
{
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
+ css::uno::Any ex( cppu::getCaughtException() );
+ SAL_WARN("unotools", "Unexpected exception caught. " << exceptionToString(ex));
}
}
@@ -556,10 +567,11 @@ css::uno::Reference< css::uno::XInterface > SvtViewOptionsBase_Impl::impl_getSet
}
catch(const css::container::NoSuchElementException&)
{ xNode.clear(); }
- catch(const css::uno::Exception& ex)
+ catch(const css::uno::Exception&)
{
+ css::uno::Any ex( cppu::getCaughtException() );
xNode.clear();
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
+ SAL_WARN("unotools", "Unexpected exception caught. " << exceptionToString(ex));
}
return xNode;