diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-03-01 14:42:38 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-03-07 07:12:39 +0100 |
commit | 8b5e23eac31cafbd442a3acab5fbcf98bfd0af11 (patch) | |
tree | d41feeea533127280e0503d0dc2dd55a4ab83ce8 /sw | |
parent | 4f810905fa74128871f2fe924a3d28a79f4e4261 (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 'sw')
-rw-r--r-- | sw/source/core/access/accmap.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/edit/edundo.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexport.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/xml/swxml.cxx | 24 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlfmt.cxx | 7 | ||||
-rw-r--r-- | sw/source/ui/vba/vbadocumentproperties.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 21 | ||||
-rw-r--r-- | sw/source/uibase/dbui/mmconfigitem.cxx | 16 |
8 files changed, 62 insertions, 36 deletions
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index a720020a7fc4..876d9fc59d2e 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -73,6 +73,7 @@ #include <dflyobj.hxx> #include <prevwpage.hxx> #include <calbck.hxx> +#include <tools/diagnose_ex.h> using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; @@ -192,9 +193,10 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/, { xListener->notifyEvent( aEvent ); } - catch( uno::RuntimeException const & r ) + catch( uno::RuntimeException const & ) { - SAL_WARN("sw.a11y", "Runtime exception caught while notifying shape: " << r); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("sw.a11y", "Runtime exception caught while notifying shape: " << exceptionToString(ex)); } } } diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx index 2dc552cbf129..79e8930e39ec 100644 --- a/sw/source/core/edit/edundo.cxx +++ b/sw/source/core/edit/edundo.cxx @@ -19,6 +19,7 @@ #include <svx/svdview.hxx> #include <sal/log.hxx> +#include <tools/diagnose_ex.h> #include <editsh.hxx> #include <fesh.hxx> @@ -132,8 +133,9 @@ void SwEditShell::Undo(sal_uInt16 const nCount) bRet = GetDoc()->GetIDocumentUndoRedo().Undo() || bRet; } - } catch (const css::uno::Exception & e) { - SAL_WARN("sw.core", "SwEditShell::Undo(): exception caught: " << e); + } catch (const css::uno::Exception &) { + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("sw.core", "SwEditShell::Undo(): exception caught: " << exceptionToString(ex)); } if (bRestoreCursor) @@ -185,8 +187,9 @@ void SwEditShell::Redo(sal_uInt16 const nCount) bRet = GetDoc()->GetIDocumentUndoRedo().Redo() || bRet; } - } catch (const css::uno::Exception & e) { - SAL_WARN("sw.core", "SwEditShell::Redo(): exception caught: " << e); + } catch (const css::uno::Exception &) { + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("sw.core", "SwEditShell::Redo(): exception caught: " << exceptionToString(ex)); } Pop(bRestoreCursor ? PopMode::DeleteCurrent : PopMode::DeleteStack); @@ -210,8 +213,9 @@ void SwEditShell::Repeat(sal_uInt16 const nCount) try { ::sw::RepeatContext context(*GetDoc(), *GetCursor()); GetDoc()->GetIDocumentUndoRedo().Repeat( context, nCount ); - } catch (const css::uno::Exception & e) { - SAL_WARN("sw.core", "SwEditShell::Repeat(): exception caught: " << e); + } catch (const css::uno::Exception &) { + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("sw.core", "SwEditShell::Repeat(): exception caught: " << exceptionToString(ex)); } EndAllAction(); diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 3aa8706bed1d..33eb71468d52 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -85,6 +85,7 @@ #include <sal/log.hxx> #include <vcl/font.hxx> #include <unotools/ucbstreamhelper.hxx> +#include <tools/diagnose_ex.h> using namespace sax_fastparser; using namespace ::comphelper; @@ -1440,7 +1441,8 @@ void DocxExport::WriteEmbeddings() } catch(const uno::Exception&) { - SAL_WARN("sw.ww8", "WriteEmbeddings() ::Failed to copy Inputstream to outputstream exception caught!"); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("sw.ww8", "WriteEmbeddings() ::Failed to copy Inputstream to outputstream exception caught! " << exceptionToString(ex)); } xOutStream->closeOutput(); } diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index 0aec06ae11d0..c125e92dc056 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -85,6 +85,7 @@ #include <istyleaccess.hxx> #include <sfx2/DocumentMetadataAccess.hxx> +#include <tools/diagnose_ex.h> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -185,8 +186,9 @@ ErrCode ReadThroughComponent( else xParser->parseStream( aParserInput ); } - catch( xml::sax::SAXParseException& r ) + catch( xml::sax::SAXParseException& r) { + css::uno::Any ex( cppu::getCaughtException() ); // sax parser sends wrapped exceptions, // try to find the original one xml::sax::SAXException aSaxEx = *static_cast<xml::sax::SAXException*>(&r); @@ -208,7 +210,7 @@ ErrCode ReadThroughComponent( if( bEncrypted ) return ERRCODE_SFX_WRONGPASSWORD; - SAL_WARN( "sw", "SAX parse exception caught while importing: " << r ); + SAL_WARN( "sw", "SAX parse exception caught while importing: " << exceptionToString(ex) ); const OUString sErr( OUString::number( r.LineNumber ) + "," @@ -231,6 +233,7 @@ ErrCode ReadThroughComponent( } catch(const xml::sax::SAXException& r) { + css::uno::Any ex( cppu::getCaughtException() ); packages::zip::ZipIOException aBrokenPackage; if ( r.WrappedException >>= aBrokenPackage ) return ERRCODE_IO_BROKENPACKAGE; @@ -238,22 +241,25 @@ ErrCode ReadThroughComponent( if( bEncrypted ) return ERRCODE_SFX_WRONGPASSWORD; - SAL_WARN( "sw", "SAX exception caught while importing: " << r); + SAL_WARN( "sw", "uno exception caught while importing: " << exceptionToString(ex) ); return ERR_SWG_READ_ERROR; } - catch(const packages::zip::ZipIOException& r) + catch(const packages::zip::ZipIOException&) { - SAL_WARN( "sw", "Zip exception caught while importing: " << r); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sw", "uno exception caught while importing: " << exceptionToString(ex) ); return ERRCODE_IO_BROKENPACKAGE; } - catch(const io::IOException& r) + catch(const io::IOException&) { - SAL_WARN( "sw", "IO exception caught while importing: " << r); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sw", "uno exception caught while importing: " << exceptionToString(ex) ); return ERR_SWG_READ_ERROR; } - catch(const uno::Exception& r) + catch(const uno::Exception&) { - SAL_WARN( "sw", "uno exception caught while importing: " << r ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sw", "uno exception caught while importing: " << exceptionToString(ex) ); return ERR_SWG_READ_ERROR; } diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index f08f7ba562ec..9f9423f04ac7 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -20,7 +20,7 @@ #include <rtl/ustrbuf.hxx> #include <sal/log.hxx> #include <osl/diagnose.h> - +#include <tools/diagnose_ex.h> #include <xmloff/nmspmap.hxx> #include <format.hxx> #include <fmtcol.hxx> @@ -343,9 +343,10 @@ SwXMLTextStyleContext_Impl::Finish( bool bOverwrite ) { xPropSet->setPropertyValue(UNO_NAME_PARA_STYLE_CONDITIONS, uno::makeAny(aSeq)); } - catch (uno::Exception const& e) + catch (uno::Exception const&) { - SAL_WARN("sw.xml", "exception when setting ParaStyleConditions: " << e); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("sw.xml", "exception when setting ParaStyleConditions: " << exceptionToString(ex)); } } XMLTextStyleContext::Finish( bOverwrite ); diff --git a/sw/source/ui/vba/vbadocumentproperties.cxx b/sw/source/ui/vba/vbadocumentproperties.cxx index c83c469734cb..cf8d1f3017a0 100644 --- a/sw/source/ui/vba/vbadocumentproperties.cxx +++ b/sw/source/ui/vba/vbadocumentproperties.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/beans/XPropertyContainer.hpp> #include <ooo/vba/word/WdBuiltInProperty.hpp> #include <ooo/vba/office/MsoDocProperties.hpp> +#include <tools/diagnose_ex.h> #include <memory> #include "wordvbahelper.hxx" #include <fesh.hxx> @@ -301,7 +302,8 @@ public: } catch (const uno::Exception&) { - SAL_WARN("sw.vba", "Got exception"); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("sw.vba", "Got exception " << exceptionToString(ex)); } uno::Any aReturn; if ( rPropName == "LineCount" ) // special processing needed diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index d5e5790445b1..49ecccf6a573 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -113,6 +113,7 @@ #include <connectivity/dbtools.hxx> #include <connectivity/dbconversion.hxx> #include <unotools/charclass.hxx> +#include <tools/diagnose_ex.h> #include <unomailmerge.hxx> #include <sfx2/event.hxx> @@ -2074,9 +2075,10 @@ OUString SwDBManager::GetDBField(uno::Reference<beans::XPropertySet> const & xCo } } } - catch (const uno::Exception& e) + catch (const uno::Exception&) { - SAL_WARN("sw.mailmerge", "exception caught: " << e); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("sw.mailmerge", "exception caught: " << exceptionToString(ex)); } } @@ -3171,9 +3173,10 @@ void SwDBManager::InsertText(SwWrtShell& rSh, { pDlg->DataToDoc( aSelection , xSource, xConnection, xResSet); } - catch (const uno::Exception& e) + catch (const uno::Exception&) { - SAL_WARN("sw.mailmerge", "exception caught: " << e); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("sw.mailmerge", "exception caught: " << exceptionToString(ex)); } } } @@ -3189,9 +3192,10 @@ uno::Reference<sdbc::XDataSource> SwDBManager::getDataSourceAsParent(const uno:: if ( !xSource.is() ) xSource = dbtools::getDataSource(_sDataSourceName, ::comphelper::getProcessComponentContext()); } - catch (const uno::Exception& e) + catch (const uno::Exception&) { - SAL_WARN("sw.mailmerge", "exception caught in getDataSourceAsParent(): " << e); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("sw.mailmerge", "exception caught in getDataSourceAsParent(): " << exceptionToString(ex)); } return xSource; } @@ -3229,9 +3233,10 @@ uno::Reference<sdbc::XResultSet> SwDBManager::createCursor(const OUString& _sDat } } } - catch (const uno::Exception& e) + catch (const uno::Exception&) { - SAL_WARN("sw.mailmerge", "Caught exception while creating a new RowSet: " << e); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("sw.mailmerge", "Caught exception while creating a new RowSet: " << exceptionToString(ex)); } return xResultSet; } diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx index 3c641d4dbc0b..930c5631864c 100644 --- a/sw/source/uibase/dbui/mmconfigitem.cxx +++ b/sw/source/uibase/dbui/mmconfigitem.cxx @@ -36,6 +36,7 @@ #include <rtl/instance.hxx> #include <sal/log.hxx> #include <unotools/configitem.hxx> +#include <tools/diagnose_ex.h> #include <mailmergehelper.hxx> #include <swunohelper.hxx> #include <dbmgr.hxx> @@ -885,18 +886,20 @@ Reference< XResultSet> const & SwMailMergeConfigItem::GetResultSet() const xRowProperties->setPropertyValue("ApplyFilter", makeAny(!m_pImpl->m_sFilter.isEmpty())); xRowProperties->setPropertyValue("Filter", makeAny(m_pImpl->m_sFilter)); } - catch (const Exception& e) + catch (const Exception&) { - SAL_WARN("sw.ui", "exception caught: " << e); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("sw.ui", "exception caught: " << exceptionToString(ex)); } xRowSet->execute(); m_pImpl->m_xResultSet = xRowSet.get(); m_pImpl->m_xResultSet->first(); m_pImpl->m_nResultSetCursorPos = 1; } - catch (const Exception& e) + catch (const Exception&) { - SAL_WARN("sw.ui", "exception caught in: SwMailMergeConfigItem::GetResultSet() " << e); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("sw.ui", "exception caught in: SwMailMergeConfigItem::GetResultSet() " << exceptionToString(ex)); } } return m_pImpl->m_xResultSet; @@ -932,9 +935,10 @@ void SwMailMergeConfigItem::SetFilter(OUString const & rFilter) uno::Reference<XRowSet> xRowSet( m_pImpl->m_xResultSet, UNO_QUERY_THROW ); xRowSet->execute(); } - catch (const Exception& e) + catch (const Exception&) { - SAL_WARN("sw.ui", "exception caught in SwMailMergeConfigItem::SetFilter(): " << e); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("sw.ui", "exception caught in SwMailMergeConfigItem::SetFilter(): " << exceptionToString(ex)); } } } |