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 /sfx2 | |
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 'sfx2')
-rw-r--r-- | sfx2/source/appl/appdde.cxx | 15 | ||||
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/appl/newhelp.cxx | 26 | ||||
-rw-r--r-- | sfx2/source/appl/sfxhelp.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/bastyp/helper.cxx | 23 | ||||
-rw-r--r-- | sfx2/source/dialog/backingwindow.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/dialog/filedlghelper.cxx | 13 | ||||
-rw-r--r-- | sfx2/source/doc/DocumentMetadataAccess.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/doc/doctempl.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplates.cxx | 9 |
12 files changed, 68 insertions, 63 deletions
diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index 261ef18a1fa3..ac556afa7f42 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -93,21 +93,10 @@ namespace ::ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), uno::Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() ); bRet = aCnt.isDocument(); } - catch( const ucb::CommandAbortedException& ) - { - SAL_INFO( "sfx.appl", "CommandAbortedException" ); - } - catch( const ucb::IllegalIdentifierException& ) - { - SAL_INFO( "sfx.appl", "IllegalIdentifierException" ); - } - catch( const ucb::ContentCreationException& ) - { - SAL_INFO( "sfx.appl", "IllegalIdentifierException" ); - } catch( const uno::Exception& ) { - SAL_WARN( "sfx.appl", "Any other exception" ); + css::uno::Any ex = cppu::getCaughtException(); + SAL_WARN( "sfx.appl", exceptionToString(ex) ); } return bRet; diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index c972a4bfd301..314a9587a69f 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -1393,7 +1393,8 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) } catch( const css::uno::Exception& ) { - SAL_WARN( "sfx.appl", "SfxApplication::OfaExec_Impl(SID_MORE_DICTIONARIES): caught an exception!" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.appl", "SfxApplication::OfaExec_Impl(SID_MORE_DICTIONARIES): caught an exception " << exceptionToString(ex) ); } break; } diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index d4e774b1f775..1e643918361e 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -33,6 +33,7 @@ #include <sal/log.hxx> #include <osl/diagnose.h> #include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include <sfx2/strings.hrc> #include <helpids.h> @@ -2030,9 +2031,10 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox() Any aAny = ConfigurationHelper::readRelativeKey( xConfiguration, sPath, KEY_UI_NAME ); aAny >>= sTemp; } - catch( Exception& ) + catch( Exception const & ) { - SAL_WARN( "sfx.appl", "SfxHelpTextWindow_Impl::InitOnStartupBox(): unexpected exception" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.appl", "SfxHelpTextWindow_Impl::InitOnStartupBox(): unexpected exception " << exceptionToString(ex) ); } sModuleName = sTemp; } @@ -2283,9 +2285,10 @@ IMPL_LINK( SfxHelpTextWindow_Impl, CheckHdl, Button*, pButton, void ) xConfiguration, PATH_OFFICE_FACTORIES + sCurrentFactory, KEY_HELP_ON_OPEN, makeAny( bChecked ) ); ConfigurationHelper::flush( xConfiguration ); } - catch( Exception& ) + catch( Exception const & ) { - SAL_WARN( "sfx.appl", "SfxHelpTextWindow_Impl::CheckHdl(): unexpected exception" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.appl", "SfxHelpTextWindow_Impl::CheckHdl(): unexpected exception " << exceptionToString(ex) ); } } @@ -2439,9 +2442,10 @@ void SfxHelpTextWindow_Impl::GetFocus() xWindow->setFocus(); } } - catch( Exception& ) + catch( Exception const & ) { - SAL_WARN( "sfx.appl", "SfxHelpTextWindow_Impl::GetFocus(): unexpected exception" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.appl", "SfxHelpTextWindow_Impl::GetFocus(): unexpected exception " << exceptionToString(ex) ); } } @@ -2526,9 +2530,10 @@ void SfxHelpTextWindow_Impl::SetPageStyleHeaderOff() const } } } - catch( Exception& ) + catch( Exception const & ) { - SAL_WARN( "sfx.appl", "SfxHelpTextWindow_Impl::SetPageStyleHeaderOff(): unexpected exception" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.appl", "SfxHelpTextWindow_Impl::SetPageStyleHeaderOff(): unexpected exception " << exceptionToString(ex) ); } SAL_WARN_IF( !bSetOff, "sfx.appl", "SfxHelpTextWindow_Impl::SetPageStyleHeaderOff(): set off failed" ); @@ -3098,9 +3103,10 @@ void SfxHelpWindow_Impl::CloseWindow() xCloser->close( false ); } } - catch( Exception& ) + catch( Exception const & ) { - SAL_WARN( "sfx.appl", "SfxHelpWindow_Impl::CloseWindow(): caught an exception" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.appl", "SfxHelpWindow_Impl::CloseWindow(): caught an exception " << exceptionToString(ex) ); } } diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 80d521b39a47..f305c3a04ee6 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -83,6 +83,7 @@ #include <sfx2/frame.hxx> #include <rtl/string.hxx> #include <svtools/langtab.hxx> +#include <tools/diagnose_ex.h> using namespace ::com::sun::star::beans; using namespace ::com::sun::star::frame; @@ -399,7 +400,8 @@ static OUString getCurrentModuleIdentifier_Impl() } catch (const Exception&) { - SAL_WARN( "sfx.appl", "SfxHelp::getCurrentModuleIdentifier_Impl(): exception of XModuleManager::identify()" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.appl", "SfxHelp::getCurrentModuleIdentifier_Impl(): exception of XModuleManager::identify() " << exceptionToString(ex) ); } } @@ -480,7 +482,8 @@ OUString SfxHelp::GetHelpModuleName_Impl(const OUString& rHelpID) } catch (const Exception&) { - SAL_WARN( "sfx.appl", "SfxHelp::GetHelpModuleName_Impl(): exception of XNameAccess::getByName()" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.appl", "SfxHelp::GetHelpModuleName_Impl(): " << exceptionToString(ex) ); } } } diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx index 2cc201acface..6588834a3096 100644 --- a/sfx2/source/bastyp/helper.cxx +++ b/sfx2/source/bastyp/helper.cxx @@ -38,7 +38,7 @@ #include <unotools/localedatawrapper.hxx> #include <rtl/strbuf.hxx> #include <sal/log.hxx> - +#include <tools/diagnose_ex.h> #include <tools/debug.hxx> #include <tools/urlobj.hxx> #include <tools/datetime.hxx> @@ -76,13 +76,10 @@ std::vector<OUString> SfxContentHelper::GetResultSet( const OUString& rURL ) if ( xDynResultSet.is() ) xResultSet = xDynResultSet->getStaticResultSet(); } - catch( const ucb::CommandAbortedException& ) - { - SAL_WARN( "sfx.bastyp", "GetResultSet: CommandAbortedException" ); - } catch( const uno::Exception& ) { - SAL_WARN( "sfx.bastyp", "GetResultSet: Any other exception" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.bastyp", "GetResultSet: " << exceptionToString(ex) ); } @@ -105,13 +102,10 @@ std::vector<OUString> SfxContentHelper::GetResultSet( const OUString& rURL ) aList.push_back( aRow ); } } - catch( const ucb::CommandAbortedException& ) - { - SAL_WARN( "sfx.bastyp", "XContentAccess::next(): CommandAbortedException" ); - } catch( const uno::Exception& ) { - SAL_WARN( "sfx.bastyp", "XContentAccess::next(): Any other exception" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.bastyp", "XContentAccess::next(): " << exceptionToString(ex) ); } } } @@ -251,13 +245,10 @@ sal_Int64 SfxContentHelper::GetSize( const OUString& rContent ) ::ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), uno::Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() ); aCnt.getPropertyValue( "Size" ) >>= nSize; } - catch( const ucb::CommandAbortedException& ) - { - SAL_WARN( "sfx.bastyp", "CommandAbortedException" ); - } catch( const uno::Exception& ) { - SAL_WARN( "sfx.bastyp", "Any other exception" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.bastyp", exceptionToString(ex) ); } return nSize; } diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index 45dd2af33006..d3fad16db845 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -44,6 +44,7 @@ #include <comphelper/propertysequence.hxx> #include <toolkit/awt/vclxmenu.hxx> +#include <tools/diagnose_ex.h> #include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -130,9 +131,10 @@ BackingWindow::BackingWindow( vcl::Window* i_pParent ) : { mxContext.set( ::comphelper::getProcessComponentContext(), uno::UNO_SET_THROW ); } - catch (const Exception& e) + catch (const Exception&) { - SAL_WARN( "fwk", "BackingWindow - caught an exception! " << e ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "fwk", "BackingWindow - caught an exception! " << exceptionToString(ex) ); } // fdo#34392: we do the layout dynamically, the layout depends on the font, diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 41087c90d276..4c243102653d 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -76,6 +76,7 @@ #include <bitmaps.hlst> #include <vcl/help.hxx> #include <vcl/builderfactory.hxx> +#include <tools/diagnose_ex.h> #include <algorithm> @@ -413,15 +414,17 @@ void SfxDocumentInfoItem::UpdateDocumentInfo( xContainer->addProperty( pProp->m_sName, beans::PropertyAttribute::REMOVABLE, pProp->m_aValue ); } - catch ( Exception& ) + catch ( Exception const & ) { - SAL_WARN( "sfx.dialog", "SfxDocumentInfoItem::updateDocumentInfo(): exception while adding custom properties" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.dialog", "SfxDocumentInfoItem::updateDocumentInfo(): exception while adding custom properties " << exceptionToString(ex) ); } } } - catch ( Exception& ) + catch ( Exception const & ) { - SAL_WARN( "sfx.dialog", "SfxDocumentInfoItem::updateDocumentInfo(): exception while removing custom properties" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.dialog", "SfxDocumentInfoItem::updateDocumentInfo(): exception while removing custom properties " << exceptionToString(ex) ); } } diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 33c7ed012f40..aa3612581296 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -93,6 +93,7 @@ #include <rtl/strbuf.hxx> #include <sal/log.hxx> #include <comphelper/sequence.hxx> +#include <tools/diagnose_ex.h> #ifdef UNX #include <errno.h> @@ -486,7 +487,8 @@ void FileDialogHelper_Impl::updateExportButton() } catch( const IllegalArgumentException& ) { - SAL_WARN( "sfx.dialog", "FileDialogHelper_Impl::updateExportButton: caught an exception!" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.dialog", "FileDialogHelper_Impl::updateExportButton: caught an exception " << exceptionToString(ex) ); } } } @@ -594,7 +596,8 @@ void FileDialogHelper_Impl::updatePreviewState( bool _bUpdatePreviewWindow ) } catch( const Exception& ) { - SAL_WARN( "sfx.dialog", "FileDialogHelper_Impl::updatePreviewState: caught an exception!" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.dialog", "FileDialogHelper_Impl::updatePreviewState: caught an exception " << exceptionToString(ex) ); } } @@ -1295,7 +1298,8 @@ sal_Int16 FileDialogHelper_Impl::implDoExecute() } catch( const Exception& ) { - SAL_WARN( "sfx.dialog", "FileDialogHelper_Impl::implDoExecute: caught an exception!" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.dialog", "FileDialogHelper_Impl::implDoExecute: caught an exception " << exceptionToString(ex) ); } } @@ -1323,7 +1327,8 @@ void FileDialogHelper_Impl::implStartExecute() } catch( const Exception& ) { - SAL_WARN( "sfx.dialog", "FileDialogHelper_Impl::implDoExecute: caught an exception!" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.dialog", "FileDialogHelper_Impl::implDoExecute: caught an exception " << exceptionToString(ex) ); } } } diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx index d26a2cd384b0..af3e99c930fa 100644 --- a/sfx2/source/doc/DocumentMetadataAccess.cxx +++ b/sfx2/source/doc/DocumentMetadataAccess.cxx @@ -51,6 +51,7 @@ #include <sfx2/docfile.hxx> #include <sfx2/XmlIdRegistry.hxx> #include <sfx2/objsh.hxx> +#include <tools/diagnose_ex.h> #include <libxml/tree.h> @@ -571,7 +572,8 @@ collectFilesFromStorage(uno::Reference<embed::XStorage> const& i_xStorage, o_rFiles.insert(styles); } } catch (const uno::Exception &) { - SAL_WARN("sfx", "collectFilesFromStorage: exception?"); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("sfx", "collectFilesFromStorage: " << exceptionToString(ex)); } } diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 6efbb67e4270..817f76f33829 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -130,6 +130,7 @@ #include <officecfg/Office/Common.hxx> #include <comphelper/propertysequence.hxx> #include <vcl/weld.hxx> +#include <tools/diagnose_ex.h> #include <com/sun/star/io/WrongFormatException.hpp> @@ -1311,7 +1312,8 @@ SfxMedium::LockFileResult SfxMedium::LockOrigFileOnDemand( bool bLoading, bool b } catch ( const uno::Exception& ) { - SAL_WARN( "sfx.doc", "Locking exception: WebDAV while trying to lock the file" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.doc", "Locking exception: WebDAV while trying to lock the file " << exceptionToString(ex) ); } return eResult; } @@ -1539,7 +1541,8 @@ SfxMedium::LockFileResult SfxMedium::LockOrigFileOnDemand( bool bLoading, bool b } catch( const uno::Exception& ) { - SAL_WARN( "sfx.doc", "Locking exception: high probability, that the content has not been created" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.doc", "Locking exception: high probability, that the content has not been created " << exceptionToString(ex) ); } return eResult; @@ -3001,7 +3004,8 @@ void SfxMedium::UnlockFile( bool bReleaseLockStream ) } catch ( uno::Exception& ) { - SAL_WARN( "sfx.doc", "Locking exception: WebDAV while trying to lock the file" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.doc", "Locking exception: WebDAV while trying to lock the file " << exceptionToString(ex) ); } } return; diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index 139d4aaa4c41..95e23b67c4ba 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -30,6 +30,7 @@ #include <unotools/pathoptions.hxx> #include <tools/urlobj.hxx> #include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include <svtools/ehdl.hxx> #include <svtools/sfxecode.hxx> #include <comphelper/processfactory.hxx> @@ -1658,7 +1659,8 @@ void SfxDocTemplate_Impl::Rescan() } catch( const Exception& ) { - SAL_WARN( "sfx.doc", "SfxDocTemplate_Impl::Rescan: caught an exception while doing the update!" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.doc", "SfxDocTemplate_Impl::Rescan: caught an exception while doing the update! " << exceptionToString(ex) ); } } diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 157539132710..f3b7c4eeb48c 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -775,13 +775,10 @@ bool SfxDocTplService_Impl::createFolder( const OUString& rNewFolderURL, aParent.insertNewContent( aType, aNames, aValues, rNewFolder ); bCreatedFolder = true; } - catch( RuntimeException& ) + catch( Exception const & ) { - SAL_WARN( "sfx.doc", "createFolder(): got runtime exception" ); - } - catch( Exception& ) - { - SAL_WARN( "sfx.doc", "createFolder(): Could not create new folder" ); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN( "sfx.doc", "createFolder(): Could not create new folder " << exceptionToString(ex) ); } } else if ( bCreateParent ) |