diff options
40 files changed, 562 insertions, 269 deletions
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 05e2dbb7792d..821bf5d06fbf 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -913,7 +913,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL, "basic", "couldn't open sub storage for library \"" << rLib.aName << "\". Exception: " - << comphelper::anyToString(aError)); + << exceptionToString(aError)); #endif } } @@ -1943,7 +1943,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto "basic", "couldn't create sub storage for library \"" << rLib.aName << "\". Exception: " - << comphelper::anyToString(aError)); + << exceptionToString(aError)); throw; } #endif @@ -2353,8 +2353,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name ) SAL_WARN( "basic", "couldn't open sub storage for library \"" << Name - << "\". Exception: " - << comphelper::anyToString(aError)); + << "\". Exception: " << exceptionToString(aError)); throw; } #endif diff --git a/canvas/source/directx/dx_config.cxx b/canvas/source/directx/dx_config.cxx index 487f04f0f686..5d805dcb54db 100644 --- a/canvas/source/directx/dx_config.cxx +++ b/canvas/source/directx/dx_config.cxx @@ -26,6 +26,7 @@ #include <comphelper/anytostring.hxx> #include <cppuhelper/exc_hlp.hxx> #include <osl/diagnose.h> +#include <tools/diagnose_ex.h> #include "dx_config.hxx" @@ -83,7 +84,7 @@ namespace dxcanvas } catch( const uno::Exception& ) { - SAL_WARN( "canvas", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "canvas", exceptionToString( cppu::getCaughtException() ) ); } } @@ -114,7 +115,7 @@ namespace dxcanvas } catch( const uno::Exception& ) { - SAL_WARN( "canvas", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "canvas", exceptionToString( cppu::getCaughtException() ) ); } } diff --git a/comphelper/source/misc/documentinfo.cxx b/comphelper/source/misc/documentinfo.cxx index 5c460e07f043..8d96d5f5e77e 100644 --- a/comphelper/source/misc/documentinfo.cxx +++ b/comphelper/source/misc/documentinfo.cxx @@ -30,7 +30,6 @@ #include <cppuhelper/exc_hlp.hxx> #include <osl/diagnose.h> -#include <osl/thread.h> #include <sal/log.hxx> namespace comphelper { @@ -147,6 +146,7 @@ namespace comphelper { } catch ( const Exception& ) { + // Cannot use tools::exceptionToString here, because the tools module depends on the comphelper module css::uno::Any caught( ::cppu::getCaughtException() ); css::uno::Exception exception; caught >>= exception; diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 306b219afeb6..380de3eb28cd 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -69,6 +69,7 @@ #include <com/sun/star/xml/xpath/XXPathAPI.hpp> #include <com/sun/star/deployment/XPackageManager.hpp> #include <boost/optional.hpp> +#include <tools/diagnose_ex.h> #include <algorithm> #include <memory> @@ -845,8 +846,7 @@ void BackendImpl::PackageImpl::processPackage_( } catch (const Exception &) { - SAL_WARN( "desktop", ::comphelper::anyToString( - ::cppu::getCaughtException() ) ); + SAL_WARN( "desktop", exceptionToString( cppu::getCaughtException() ) ); // ignore any errors of rollback } } @@ -933,7 +933,7 @@ OUString BackendImpl::PackageImpl::getDescription() } catch ( const css::deployment::DeploymentException& ) { - SAL_WARN( "desktop", ::comphelper::anyToString( ::cppu::getCaughtException() ) ); + SAL_WARN( "desktop", exceptionToString( cppu::getCaughtException() ) ); } } @@ -1055,8 +1055,7 @@ void BackendImpl::PackageImpl::exportTo( } // xxx todo: think about exception specs: catch (const deployment::DeploymentException &) { - SAL_WARN( "desktop", ::comphelper::anyToString( - ::cppu::getCaughtException() ) ); + SAL_WARN( "desktop", exceptionToString( cppu::getCaughtException() ) ); } catch (const lang::IllegalArgumentException & exc) { SAL_WARN( "desktop", exc ); diff --git a/include/tools/diagnose_ex.h b/include/tools/diagnose_ex.h index 6d63c215dedc..596e44c4694d 100644 --- a/include/tools/diagnose_ex.h +++ b/include/tools/diagnose_ex.h @@ -129,6 +129,10 @@ inline css::uno::Any DbgGetCaughtException() return; \ } +/** Convert a caught exception to a string suitable for logging. +*/ +TOOLS_DLLPUBLIC OString exceptionToString(css::uno::Any const & caughtEx); + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index f2477b2cef6e..f08d86bf7bd1 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -23,6 +23,7 @@ #include <osl/diagnose.h> #include <sal/log.hxx> #include <tools/multisel.hxx> +#include <tools/diagnose_ex.h> #include <com/sun/star/drawing/XMasterPagesSupplier.hpp> #include <com/sun/star/drawing/XDrawPages.hpp> @@ -442,7 +443,7 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage catch( uno::Exception& ) { SAL_WARN( "oox", "oox::ppt::PresentationFragmentHandler::EndDocument(), " - "exception caught: " << comphelper::anyToString( cppu::getCaughtException() ) ); + "exception caught: " << exceptionToString( cppu::getCaughtException() ) ); } } @@ -493,7 +494,7 @@ void PresentationFragmentHandler::finalizeImport() catch( uno::Exception& ) { SAL_WARN( "oox", "oox::ppt::PresentationFragmentHandler::finalizeImport(), " - "exception caught: " << comphelper::anyToString( cppu::getCaughtException() ) ); + "exception caught: " << exceptionToString( cppu::getCaughtException() ) ); } // todo error handling; if ( rxStatusIndicator.is() ) diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index b12298829052..1c3b58be6274 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/container/XNamed.hpp> #include <osl/diagnose.h> #include <sal/log.hxx> +#include <tools/diagnose_ex.h> #include <oox/helper/attributelist.hxx> #include <oox/helper/propertyset.hxx> @@ -251,7 +252,7 @@ void SlideFragmentHandler::finalizeImport() catch( uno::Exception& ) { SAL_WARN( "oox", "oox::ppt::SlideFragmentHandler::EndElement(), " - "exception caught: " << comphelper::anyToString( cppu::getCaughtException() ) ); + "exception caught: " << exceptionToString( cppu::getCaughtException() ) ); } } diff --git a/package/Library_xstor.mk b/package/Library_xstor.mk index 03e7f5c90db9..b6498b8c128f 100644 --- a/package/Library_xstor.mk +++ b/package/Library_xstor.mk @@ -26,6 +26,7 @@ $(eval $(call gb_Library_use_libraries,xstor,\ cppuhelper \ sal \ salhelper \ + tl \ )) $(eval $(call gb_Library_add_exception_objects,xstor,\ diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 63cdbad804ed..5b271decc1c9 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -48,6 +48,7 @@ #include <rtl/digest.h> #include <rtl/instance.hxx> +#include <tools/diagnose_ex.h> #include <PackageConstants.hxx> @@ -2360,10 +2361,10 @@ void SAL_CALL OWriteStream::dispose() m_pImpl->Revert(); } } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); throw lang::WrappedTargetRuntimeException("Can not commit/revert the storage!", static_cast< OWeakObject* >( this ), aCaught ); @@ -2489,10 +2490,10 @@ sal_Bool SAL_CALL OWriteStream::hasEncryptionData() SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); throw lang::WrappedTargetRuntimeException( "Problems on hasEncryptionData!", static_cast< ::cppu::OWeakObject* >( this ), aCaught ); @@ -3169,10 +3170,10 @@ void SAL_CALL OWriteStream::commit() SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); throw embed::StorageWrappedTargetException( "Problems on commit!", static_cast< ::cppu::OWeakObject* >( this ), aCaught ); @@ -3224,10 +3225,10 @@ void SAL_CALL OWriteStream::revert() SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); throw embed::StorageWrappedTargetException( "Problems on revert!", static_cast< ::cppu::OWeakObject* >( this ), aCaught ); diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 2dc532324084..59fc6ac888c1 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -55,6 +55,7 @@ #include <comphelper/storagehelper.hxx> #include <comphelper/ofopxmlhelper.hxx> +#include <tools/diagnose_ex.h> #include "xstorage.hxx" #include "owriteablestream.hxx" @@ -2216,11 +2217,11 @@ void SAL_CALL OStorage::copyToStorage( const uno::Reference< embed::XStorage >& SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't copy storage!", uno::Reference< io::XInputStream >(), aCaught ); @@ -2293,11 +2294,11 @@ uno::Reference< io::XStream > SAL_CALL OStorage::openStreamElement( SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException(THROW_WHERE "Can't open stream element!", uno::Reference< io::XInputStream >(), aCaught ); @@ -2436,11 +2437,11 @@ uno::Reference< embed::XStorage > SAL_CALL OStorage::openStorageElement( SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't open storage!", uno::Reference< io::XInputStream >(), aCaught ); @@ -2503,11 +2504,11 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneStreamElement( const OUStr SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't clone stream!", uno::Reference< io::XInputStream >(), aCaught ); @@ -2561,11 +2562,11 @@ void SAL_CALL OStorage::copyLastCommitTo( SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't copy last commit version!", uno::Reference< io::XInputStream >(), aCaught ); @@ -2640,11 +2641,11 @@ void SAL_CALL OStorage::copyStorageElementLastCommitTo( SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't copy last commit element version!", uno::Reference< io::XInputStream >(), aCaught ); @@ -2693,11 +2694,11 @@ sal_Bool SAL_CALL OStorage::isStreamElement( const OUString& aElementName ) SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetRuntimeException( THROW_WHERE "Can't detect whether it is a stream!", uno::Reference< io::XInputStream >(), aCaught ); @@ -2751,11 +2752,11 @@ sal_Bool SAL_CALL OStorage::isStorageElement( const OUString& aElementName ) SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetRuntimeException( THROW_WHERE "can't detect whether it is a storage", uno::Reference< io::XInputStream >(), aCaught ); @@ -2828,11 +2829,11 @@ void SAL_CALL OStorage::removeElement( const OUString& aElementName ) SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't remove element!", uno::Reference< io::XInputStream >(), aCaught ); @@ -2913,11 +2914,11 @@ void SAL_CALL OStorage::renameElement( const OUString& aElementName, const OUStr SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't rename element!", uno::Reference< io::XInputStream >(), aCaught ); @@ -2998,11 +2999,11 @@ void SAL_CALL OStorage::copyElementTo( const OUString& aElementName, SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't copy element!", uno::Reference< io::XInputStream >(), aCaught ); @@ -3086,11 +3087,11 @@ void SAL_CALL OStorage::moveElementTo( const OUString& aElementName, SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't move element!", uno::Reference< io::XInputStream >(), aCaught ); @@ -3170,11 +3171,11 @@ uno::Reference< io::XStream > SAL_CALL OStorage::openEncryptedStream( SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't open encrypted stream!", uno::Reference< io::XInputStream >(), aCaught ); @@ -3245,11 +3246,11 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneEncryptedStream( SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't clone encrypted stream!", uno::Reference< io::XInputStream >(), aCaught ); @@ -3335,11 +3336,11 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getPlainRawStreamElement( SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't get plain raw stream!", uno::Reference< io::XInputStream >(), aCaught ); @@ -3435,11 +3436,11 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getRawEncrStreamElement( SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't get raw stream!", uno::Reference< io::XInputStream >(), aCaught ); @@ -3514,11 +3515,11 @@ void SAL_CALL OStorage::insertRawEncrStreamElement( const OUString& aStreamName, SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't insert raw stream!", uno::Reference< io::XInputStream >(), aCaught ); @@ -3565,11 +3566,11 @@ void SAL_CALL OStorage::commit() SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Problems on commit!", static_cast< ::cppu::OWeakObject* >( this ), aCaught ); @@ -3627,11 +3628,11 @@ void SAL_CALL OStorage::revert() SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Problems on revert!", static_cast< ::cppu::OWeakObject* >( this ), aCaught ); @@ -3791,11 +3792,11 @@ uno::Any SAL_CALL OStorage::getByName( const OUString& aName ) SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetException( THROW_WHERE "Can not open storage!", static_cast< OWeakObject* >( this ), aCaught ); @@ -3823,11 +3824,11 @@ uno::Sequence< OUString > SAL_CALL OStorage::getElementNames() SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch ( const uno::Exception& rException ) + catch ( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetRuntimeException( THROW_WHERE "Can not open storage!", static_cast< OWeakObject* >( this ), aCaught ); @@ -3860,11 +3861,11 @@ sal_Bool SAL_CALL OStorage::hasByName( const OUString& aName ) SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch ( const uno::Exception& rException ) + catch ( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetRuntimeException( THROW_WHERE "Can not open storage!", static_cast< OWeakObject* >( this ), aCaught ); @@ -3906,11 +3907,11 @@ sal_Bool SAL_CALL OStorage::hasElements() SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetRuntimeException( THROW_WHERE "Can not open storage!", static_cast< OWeakObject* >( this ), aCaught ); @@ -3937,11 +3938,11 @@ void SAL_CALL OStorage::dispose() SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetRuntimeException( THROW_WHERE "Can not open storage!", static_cast< OWeakObject* >( this ), aCaught ); @@ -4009,11 +4010,11 @@ void SAL_CALL OStorage::removeEncryption() SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch ( const uno::Exception& rException ) + catch ( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetRuntimeException( THROW_WHERE "Can not open package!", static_cast< OWeakObject* >( this ), aCaught ); @@ -4077,11 +4078,11 @@ void SAL_CALL OStorage::setEncryptionData( const uno::Sequence< beans::NamedValu SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch ( const uno::Exception& rException ) + catch ( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetRuntimeException( THROW_WHERE "Can not open package!", static_cast< OWeakObject* >( this ), aCaught ); @@ -4142,11 +4143,11 @@ void SAL_CALL OStorage::setEncryptionAlgorithms( const uno::Sequence< beans::Nam SAL_INFO("package.xstor", "Rethrow: " << aRuntimeException); throw; } - catch ( const uno::Exception& aException ) + catch ( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << aException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetRuntimeException( THROW_WHERE "Can not open package!", static_cast< OWeakObject* >( this ), aCaught ); @@ -4163,11 +4164,11 @@ void SAL_CALL OStorage::setEncryptionAlgorithms( const uno::Sequence< beans::Nam SAL_INFO("package.xstor", "Rethrow: " << aRuntimeException); throw; } - catch( const uno::Exception& aException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << aException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetRuntimeException( THROW_WHERE "Can not open package!", static_cast< OWeakObject* >( this ), aCaught ); @@ -4202,11 +4203,11 @@ void SAL_CALL OStorage::setGpgProperties( const uno::Sequence< uno::Sequence< be SAL_INFO("package.xstor", "Rethrow: " << aRuntimeException.Message); throw; } - catch ( const uno::Exception& aException ) + catch ( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << aException.Message); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetRuntimeException( THROW_WHERE "Can not open package!", static_cast< OWeakObject* >( this ), aCaught ); @@ -4223,11 +4224,11 @@ void SAL_CALL OStorage::setGpgProperties( const uno::Sequence< uno::Sequence< be SAL_INFO("package.xstor", "Rethrow: " << aRuntimeException.Message); throw; } - catch( const uno::Exception& aException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << aException.Message); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetRuntimeException( THROW_WHERE "Can not open package!", static_cast< OWeakObject* >( this ), aCaught ); @@ -4260,11 +4261,11 @@ uno::Sequence< beans::NamedValue > SAL_CALL OStorage::getEncryptionAlgorithms() SAL_INFO("package.xstor", "Rethrow: " << aRuntimeException); throw; } - catch ( const uno::Exception& aException ) + catch ( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << aException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetRuntimeException( THROW_WHERE "Can not open package!", static_cast< OWeakObject* >( this ), aCaught ); @@ -4280,11 +4281,11 @@ uno::Sequence< beans::NamedValue > SAL_CALL OStorage::getEncryptionAlgorithms() SAL_INFO("package.xstor", "Rethrow: " << aRuntimeException); throw; } - catch( const uno::Exception& aException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << aException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetRuntimeException( THROW_WHERE "Can not open package!", static_cast< OWeakObject* >( this ), aCaught ); @@ -4431,11 +4432,11 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const OUString& aPropertyName ) SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch ( const uno::Exception& rException ) + catch ( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetException( "Can't read contents!", static_cast< OWeakObject* >( this ), @@ -4489,11 +4490,11 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const OUString& aPropertyName ) SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch ( const uno::Exception& rException ) + catch ( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw lang::WrappedTargetException( THROW_WHERE "Can not open package!", static_cast< OWeakObject* >( this ), aCaught ); @@ -5001,11 +5002,11 @@ void SAL_CALL OStorage::insertStreamElementDirect( SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't insert stream directly!", uno::Reference< io::XInputStream >(), aCaught ); @@ -5084,11 +5085,11 @@ void SAL_CALL OStorage::copyElementDirectlyTo( SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't copy element directly!", uno::Reference< io::XInputStream >(), aCaught ); @@ -5140,11 +5141,11 @@ void SAL_CALL OStorage::writeAndAttachToStream( const uno::Reference< io::XStrea SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't write and attach to stream!", uno::Reference< io::XInputStream >(), aCaught ); @@ -5210,11 +5211,11 @@ void SAL_CALL OStorage::attachToURL( const OUString& sURL, SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't attach to URL!", uno::Reference< io::XInputStream >(), aCaught ); @@ -5296,11 +5297,11 @@ uno::Any SAL_CALL OStorage::getElementPropertyValue( const OUString& aElementNam SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't get element property!", uno::Reference< io::XInputStream >(), aCaught ); @@ -5365,11 +5366,11 @@ void SAL_CALL OStorage::copyStreamElementData( const OUString& aStreamName, cons SAL_INFO("package.xstor", "Rethrow: " << rRuntimeException); throw; } - catch( const uno::Exception& rException ) + catch( const uno::Exception& ) { - SAL_INFO("package.xstor", "Rethrow: " << rException); - uno::Any aCaught( ::cppu::getCaughtException() ); + SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); + throw embed::StorageWrappedTargetException( THROW_WHERE "Can't copy stream data!", uno::Reference< io::XInputStream >(), aCaught ); diff --git a/sd/source/core/CustomAnimationCloner.cxx b/sd/source/core/CustomAnimationCloner.cxx index 6e0aaac4fba3..b304edff2545 100644 --- a/sd/source/core/CustomAnimationCloner.cxx +++ b/sd/source/core/CustomAnimationCloner.cxx @@ -36,6 +36,7 @@ #include <cppuhelper/exc_hlp.hxx> #include <sal/log.hxx> #include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include <animations/animationnodehelper.hxx> #include <svx/svditer.hxx> @@ -123,7 +124,7 @@ namespace sd catch( Exception& ) { SAL_WARN( "sd", "sd::CustomAnimationClonerImpl::Clone(), " - "exception caught: " << comphelper::anyToString( cppu::getCaughtException() ) ); + "exception caught: " << exceptionToString( cppu::getCaughtException() ) ); Reference< XAnimationNode > xEmpty; return xEmpty; } @@ -200,7 +201,7 @@ namespace sd { SAL_WARN( "sd", "sd::CustomAnimationClonerImpl::transformNode(), " "exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -271,7 +272,7 @@ namespace sd { SAL_WARN( "sd", "sd::CustomAnimationClonerImpl::transformValue(), " "exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } return rValue; diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index 011da6c63203..94d55a5e79b5 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -75,6 +75,7 @@ #include <comphelper/anytostring.hxx> #include <cppuhelper/exc_hlp.hxx> #include <basegfx/polygon/b2dpolygon.hxx> +#include <tools/diagnose_ex.h> #include <drawdoc.hxx> #include <DrawDocShell.hxx> @@ -3056,7 +3057,7 @@ bool HtmlExport::checkFileExists( Reference< css::ucb::XSimpleFileAccess3 > cons catch( css::uno::Exception& ) { SAL_WARN( "sd", "sd::HtmlExport::checkFileExists(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } return false; @@ -3107,7 +3108,7 @@ bool HtmlExport::checkForExistingFiles() catch( Exception& ) { SAL_WARN( "sd", "sd::HtmlExport::checkForExistingFiles(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); bFound = false; } diff --git a/sd/source/ui/remotecontrol/Receiver.cxx b/sd/source/ui/remotecontrol/Receiver.cxx index 483ff88e9389..04b50f9a3936 100644 --- a/sd/source/ui/remotecontrol/Receiver.cxx +++ b/sd/source/ui/remotecontrol/Receiver.cxx @@ -23,6 +23,7 @@ #include <sal/log.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <vcl/svapp.hxx> +#include <tools/diagnose_ex.h> using namespace sd; using namespace ::osl; @@ -147,7 +148,7 @@ void Receiver::executeCommand( const std::vector<OString> &aCommand ) catch ( Exception& ) { SAL_WARN( "sdremote", "sd::SlideShowImpl::setPointerPosition(), " - "exception caught: " << comphelper::anyToString( cppu::getCaughtException() )); + "exception caught: " << exceptionToString( cppu::getCaughtException() )); } if (xSlideShow.is()) try @@ -161,7 +162,7 @@ void Receiver::executeCommand( const std::vector<OString> &aCommand ) catch ( Exception& ) { SAL_WARN( "sdremote", "sd::SlideShowImpl::setPointerMode(), " - "exception caught: " << comphelper::anyToString( cppu::getCaughtException() )); + "exception caught: " << exceptionToString( cppu::getCaughtException() )); } SAL_INFO( "sdremote", "Pointer started, we display the pointer on screen" ); @@ -180,7 +181,7 @@ void Receiver::executeCommand( const std::vector<OString> &aCommand ) catch ( Exception& ) { SAL_WARN( "sdremote", "sd::SlideShowImpl::setPointerMode(), " - "exception caught: " << comphelper::anyToString( cppu::getCaughtException() )); + "exception caught: " << exceptionToString( cppu::getCaughtException() )); } SAL_INFO( "sdremote", "Pointer dismissed, we hide the pointer on screen" ); @@ -205,7 +206,7 @@ void Receiver::executeCommand( const std::vector<OString> &aCommand ) catch ( Exception& ) { SAL_WARN( "sdremote", "sd::SlideShowImpl::setPointerPosition(), " - "exception caught: " << comphelper::anyToString( cppu::getCaughtException() )); + "exception caught: " << exceptionToString( cppu::getCaughtException() )); } } else if ( aCommand[0] == "presentation_resume" ) diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index b3320f992aef..ee8177df7110 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -43,6 +43,7 @@ #include <basic/sbstar.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <tools/diagnose_ex.h> #include <sfx2/infobar.hxx> #include <sfx2/request.hxx> @@ -326,7 +327,7 @@ bool AnimationSlideController::getSlideAPI( sal_Int32 nSlideNumber, Reference< X { SAL_WARN( "sd", "sd::AnimationSlideController::getSlideAPI(), " "exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } return false; @@ -619,7 +620,7 @@ void SAL_CALL SlideshowImpl::disposing() catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::stop(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } mxShow.clear(); @@ -833,7 +834,7 @@ bool SlideshowImpl::startPreview( catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::startPreview(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); bRet = false; } @@ -1033,7 +1034,7 @@ bool SlideshowImpl::startShow( PresentationSettingsEx const * pPresSettings ) catch (const Exception&) { SAL_WARN( "sd", "sd::SlideshowImpl::startShow(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); bRet = false; } @@ -1103,7 +1104,7 @@ bool SlideshowImpl::startShowImpl( const Sequence< beans::PropertyValue >& aProp catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::startShowImpl(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); return false; } } @@ -1137,7 +1138,7 @@ void SlideshowImpl::paint() catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::paint(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -1212,7 +1213,7 @@ void SlideshowImpl::removeShapeEvents() catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::removeShapeEvents(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -1244,7 +1245,7 @@ void SlideshowImpl::registerShapeEvents(sal_Int32 nSlideNumber) catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::registerShapeEvents(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -1316,7 +1317,7 @@ void SlideshowImpl::registerShapeEvents( Reference< XShapes > const & xShapes ) catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::registerShapeEvents(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -1385,7 +1386,7 @@ void SAL_CALL SlideshowImpl::pause() catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::pause(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -1415,7 +1416,7 @@ void SAL_CALL SlideshowImpl::resume() catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::resume(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } #ifdef ENABLE_SDREMOTE RemoteServer::presentationStarted( this ); @@ -1719,7 +1720,7 @@ void SlideshowImpl::updateSlideShow() catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::updateSlideShow(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -1844,7 +1845,7 @@ bool SlideshowImpl::keyInput(const KeyEvent& rKEvt) { bRet = false; SAL_WARN( "sd", "sd::SlideshowImpl::keyInput(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } return bRet; @@ -2225,7 +2226,7 @@ Reference< XSlideShow > SlideshowImpl::createSlideShow() catch( uno::Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::createSlideShow(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } return xShow; @@ -2404,7 +2405,7 @@ void SlideshowImpl::resize( const Size& rSize ) catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::resize(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -2671,7 +2672,7 @@ void SAL_CALL SlideshowImpl::setUsePen( sal_Bool bMouseAsPen ) catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::setUsePen(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -2720,7 +2721,7 @@ void SlideshowImpl::setEraseAllInk(bool bEraseAllInk) catch( Exception& ) { SAL_WARN( "sd.slideshow", "sd::SlideshowImpl::setEraseAllInk(), " - "exception caught: " << comphelper::anyToString( cppu::getCaughtException() )); + "exception caught: " << exceptionToString( cppu::getCaughtException() )); } } @@ -2920,7 +2921,7 @@ void SlideshowImpl::gotoPreviousSlide (const bool bSkipAllMainSequenceEffects) catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::gotoPreviousSlide(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -3005,7 +3006,7 @@ void SAL_CALL SlideshowImpl::stopSound( ) catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::stopSound(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index a981863a090f..8843043fb4a9 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -44,6 +44,7 @@ #include <svx/fmglob.hxx> #include <editeng/outliner.hxx> #include <svx/dialogs.hrc> +#include <tools/diagnose_ex.h> #include <view/viewoverlaymanager.hxx> @@ -245,7 +246,7 @@ void DrawViewShell::SelectionHasChanged() catch( css::uno::Exception& ) { SAL_WARN( "sd", "sd::DrawViewShell::SelectionHasChanged(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } if( HasCurrentFunction() ) diff --git a/slideshow/source/engine/activitiesqueue.cxx b/slideshow/source/engine/activitiesqueue.cxx index 484c04283236..3d1c076e2a02 100644 --- a/slideshow/source/engine/activitiesqueue.cxx +++ b/slideshow/source/engine/activitiesqueue.cxx @@ -18,8 +18,7 @@ */ -#include <comphelper/anytostring.hxx> -#include <cppuhelper/exc_hlp.hxx> +#include <tools/diagnose_ex.h> #include <osl/diagnose.h> #include <sal/log.hxx> @@ -119,7 +118,7 @@ namespace slideshow // since this will also capture segmentation // violations and the like. In such a case, we // still better let our clients now... - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString(cppu::getCaughtException()) ); } catch( SlideShowException& ) { diff --git a/slideshow/source/engine/animationnodes/animationbasenode.cxx b/slideshow/source/engine/animationnodes/animationbasenode.cxx index c600be9830e6..107ac68650a6 100644 --- a/slideshow/source/engine/animationnodes/animationbasenode.cxx +++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx @@ -208,7 +208,7 @@ bool AnimationBaseNode::init_st() mpActivity = createActivity(); } catch (uno::Exception const&) { - SAL_WARN( "slideshow", comphelper::anyToString(cppu::getCaughtException()) ); + SAL_WARN( "slideshow", exceptionToString(cppu::getCaughtException()) ); // catch and ignore. We later handle empty activities, but for // other nodes to function properly, the core functionality of // this node must remain up and running. diff --git a/slideshow/source/engine/eventqueue.cxx b/slideshow/source/engine/eventqueue.cxx index 33955faa61e4..5740a935264b 100644 --- a/slideshow/source/engine/eventqueue.cxx +++ b/slideshow/source/engine/eventqueue.cxx @@ -234,7 +234,7 @@ namespace slideshow // since this will also capture segmentation // violations and the like. In such a case, we // still better let our clients now... - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } catch( SlideShowException& ) { diff --git a/slideshow/source/engine/pointersymbol.cxx b/slideshow/source/engine/pointersymbol.cxx index 7ba9a8b20c22..dbc7fed055d3 100644 --- a/slideshow/source/engine/pointersymbol.cxx +++ b/slideshow/source/engine/pointersymbol.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/rendering/XCanvas.hpp> #include <com/sun/star/presentation/XSlideShowView.hpp> +#include <tools/diagnose_ex.h> #include "pointersymbol.hxx" #include <eventmultiplexer.hxx> @@ -126,7 +127,7 @@ void PointerSymbol::viewAdded( const UnoViewSharedPtr& rView ) } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } maViews.emplace_back( rView, sprite ); diff --git a/slideshow/source/engine/shapes/drawinglayeranimation.cxx b/slideshow/source/engine/shapes/drawinglayeranimation.cxx index 0ddbfc70b414..c8e21b5c8e15 100644 --- a/slideshow/source/engine/shapes/drawinglayeranimation.cxx +++ b/slideshow/source/engine/shapes/drawinglayeranimation.cxx @@ -935,7 +935,7 @@ std::shared_ptr<Activity> createDrawingLayerAnimActivity( catch( uno::Exception& ) { // translate any error into empty factory product. - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } return pActivity; diff --git a/slideshow/source/engine/shapes/externalshapebase.cxx b/slideshow/source/engine/shapes/externalshapebase.cxx index fc7b00ead6d1..00ba2bb2c37b 100644 --- a/slideshow/source/engine/shapes/externalshapebase.cxx +++ b/slideshow/source/engine/shapes/externalshapebase.cxx @@ -108,7 +108,7 @@ namespace slideshow } catch (uno::Exception &) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } } diff --git a/slideshow/source/engine/shapes/viewbackgroundshape.cxx b/slideshow/source/engine/shapes/viewbackgroundshape.cxx index e2fa6f3afc6b..a7cf3c26fd2f 100644 --- a/slideshow/source/engine/shapes/viewbackgroundshape.cxx +++ b/slideshow/source/engine/shapes/viewbackgroundshape.cxx @@ -185,7 +185,7 @@ namespace slideshow } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); return false; } diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx index 71f4f727d7e8..6aecf9502d1c 100644 --- a/slideshow/source/engine/shapes/viewmediashape.cxx +++ b/slideshow/source/engine/shapes/viewmediashape.cxx @@ -321,7 +321,7 @@ namespace slideshow } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } } } @@ -484,7 +484,7 @@ namespace slideshow } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } } } diff --git a/slideshow/source/engine/slide/layermanager.cxx b/slideshow/source/engine/slide/layermanager.cxx index 2fa5a139151e..84be4b5d6e2c 100644 --- a/slideshow/source/engine/slide/layermanager.cxx +++ b/slideshow/source/engine/slide/layermanager.cxx @@ -635,7 +635,7 @@ namespace slideshow { // TODO(E1): Might be superfluous. Nowadays, // addViewLayer swallows all errors, anyway. - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); // at least one shape could not be rendered bRet = false; } diff --git a/slideshow/source/engine/slide/slideanimations.cxx b/slideshow/source/engine/slide/slideanimations.cxx index 2264b4600f56..fca312a51802 100644 --- a/slideshow/source/engine/slide/slideanimations.cxx +++ b/slideshow/source/engine/slide/slideanimations.cxx @@ -56,7 +56,7 @@ namespace slideshow } catch (uno::Exception &) { - SAL_WARN( "slideshow", comphelper::anyToString(cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString(cppu::getCaughtException() ) ); } } diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 3d01f4dfbef4..4d74c69804fa 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -776,7 +776,7 @@ bool SlideImpl::implPrefetchShow() } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString(cppu::getCaughtException()) ); + SAL_WARN( "slideshow", exceptionToString(cppu::getCaughtException()) ); // TODO(E2): Error handling. For now, bail out } @@ -1026,7 +1026,7 @@ bool SlideImpl::loadShapes() } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); return false; } } @@ -1065,7 +1065,7 @@ bool SlideImpl::loadShapes() } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); return false; } diff --git a/slideshow/source/engine/slidebitmap.cxx b/slideshow/source/engine/slidebitmap.cxx index 4cf61b727678..4a92633924d6 100644 --- a/slideshow/source/engine/slidebitmap.cxx +++ b/slideshow/source/engine/slidebitmap.cxx @@ -85,7 +85,7 @@ namespace slideshow } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); return false; } diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index 177ff07dfb1b..9865d7fa5776 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -2084,7 +2084,7 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout ) } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } } diff --git a/slideshow/source/engine/soundplayer.cxx b/slideshow/source/engine/soundplayer.cxx index 505478cd3e33..65b578304d62 100644 --- a/slideshow/source/engine/soundplayer.cxx +++ b/slideshow/source/engine/soundplayer.cxx @@ -128,7 +128,7 @@ namespace slideshow dispose(); } catch (uno::Exception &) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } } diff --git a/slideshow/source/engine/waitsymbol.cxx b/slideshow/source/engine/waitsymbol.cxx index 436d058cf598..22fd912d3af7 100644 --- a/slideshow/source/engine/waitsymbol.cxx +++ b/slideshow/source/engine/waitsymbol.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/rendering/XCanvas.hpp> #include <com/sun/star/presentation/XSlideShowView.hpp> +#include <tools/diagnose_ex.h> #include "waitsymbol.hxx" #include <eventmultiplexer.hxx> @@ -130,7 +131,7 @@ void WaitSymbol::viewAdded( const UnoViewSharedPtr& rView ) } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } maViews.emplace_back( rView, sprite ); diff --git a/slideshow/test/demoshow.cxx b/slideshow/test/demoshow.cxx index 0f3087b82bde..90f9f1336b1f 100644 --- a/slideshow/test/demoshow.cxx +++ b/slideshow/test/demoshow.cxx @@ -520,7 +520,7 @@ void DemoApp::Main() } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } if( !xFactory.is() ) diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 754681fca0ad..68c972bc42a1 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -54,6 +54,7 @@ #include <comphelper/anytostring.hxx> #include <svx/svdpagv.hxx> #include <tools/globname.hxx> +#include <tools/diagnose_ex.h> #include <vcl/jobset.hxx> #include <comphelper/classids.hxx> @@ -866,8 +867,8 @@ bool SdrOle2Obj::UpdateLinkURL_Impl() } catch( css::uno::Exception const & ) { - SAL_WARN( "svx", "SdrOle2Obj::UpdateLinkURL_Impl(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "svx", "SdrOle2Obj::UpdateLinkURL_Impl(), exception: " + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -900,8 +901,8 @@ void SdrOle2Obj::BreakFileLink_Impl() } catch( css::uno::Exception& ) { - SAL_WARN( "svx", "SdrOle2Obj::BreakFileLink_Impl(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "svx", "SdrOle2Obj::BreakFileLink_Impl(), exception: " + << exceptionToString( cppu::getCaughtException() ) ); } } } @@ -1017,8 +1018,8 @@ void SdrOle2Obj::Connect_Impl() } catch( css::uno::Exception& ) { - SAL_WARN( "svx", "SdrOle2Obj::Connect_Impl(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "svx", "SdrOle2Obj::Connect_Impl(), exception: " + << exceptionToString( cppu::getCaughtException() ) ); } } } @@ -1081,8 +1082,8 @@ void SdrOle2Obj::RemoveListeners_Impl() } catch( css::uno::Exception& ) { - SAL_WARN( "svx", "SdrOle2Obj::RemoveListeners_Impl(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "svx", "SdrOle2Obj::RemoveListeners_Impl(), exception: " + << exceptionToString( cppu::getCaughtException() ) ); } } } @@ -1159,8 +1160,8 @@ void SdrOle2Obj::Disconnect_Impl() } catch( css::uno::Exception& ) { - SAL_WARN( "svx", "SdrOle2Obj::Disconnect_Impl(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "svx", "SdrOle2Obj::Disconnect_Impl(), exception: " + << exceptionToString( cppu::getCaughtException() ) ); } mpImpl->mbConnected = false; @@ -1740,8 +1741,8 @@ bool SdrOle2Obj::Unload( const uno::Reference< embed::XEmbeddedObject >& xObj, s } catch( css::uno::Exception& ) { - SAL_WARN( "svx", "SdrOle2Obj::Unload=(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "svx", "SdrOle2Obj::Unload=(), exception: " + << exceptionToString( cppu::getCaughtException() ) ); } } diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk index acd007cc4761..d6705d0b5925 100644 --- a/tools/Library_tl.mk +++ b/tools/Library_tl.mk @@ -37,6 +37,7 @@ $(eval $(call gb_Library_use_libraries,tl,\ comphelper \ i18nlangtag \ cppu \ + cppuhelper \ sal \ )) diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx index 9f32eab3267c..efecd0f5027b 100644 --- a/tools/source/debug/debug.cxx +++ b/tools/source/debug/debug.cxx @@ -29,7 +29,33 @@ #include <stdio.h> #include <com/sun/star/configuration/CorruptedConfigurationException.hpp> +#include <com/sun/star/configuration/backend/BackendSetupException.hpp> +#include <com/sun/star/configuration/backend/MalformedDataException.hpp> +#include <com/sun/star/configuration/InvalidBootstrapFileException.hpp> +#include <com/sun/star/configuration/MissingBootstrapFileException.hpp> +#include <com/sun/star/deployment/DependencyException.hpp> +#include <com/sun/star/deployment/DeploymentException.hpp> +#include <com/sun/star/document/CorruptedFilterConfigurationException.hpp> +#include <com/sun/star/document/UndoFailedException.hpp> +#include <com/sun/star/lang/WrappedTargetException.hpp> +#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> +#include <com/sun/star/ldap/LdapGenericException.hpp> +#include <com/sun/star/script/BasicErrorException.hpp> +#include <com/sun/star/script/CannotConvertException.hpp> +#include <com/sun/star/script/provider/ScriptExceptionRaisedException.hpp> +#include <com/sun/star/script/provider/ScriptFrameworkErrorException.hpp> +#include <com/sun/star/sdbc/SQLException.hpp> +#include <com/sun/star/system/SystemShellExecuteException.hpp> #include <com/sun/star/task/ErrorCodeIOException.hpp> +#include <com/sun/star/ucb/CommandFailedException.hpp> +#include <com/sun/star/ucb/ContentCreationException.hpp> +#include <com/sun/star/ucb/MissingPropertiesException.hpp> +#include <com/sun/star/ucb/NameClashException.hpp> +#include <com/sun/star/util/MalformedNumberFormatException.hpp> +#include <com/sun/star/xml/dom/DOMException.hpp> +#include <com/sun/star/xml/sax/SAXException.hpp> +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#include <comphelper/anytostring.hxx> #include <tools/debug.hxx> #include <rtl/string.h> #include <sal/log.hxx> @@ -79,55 +105,309 @@ void DbgTestSolarMutex() #endif -void DbgUnhandledException(const css::uno::Any & caught, const char* currentFunction, const char* fileAndLineNo, - const char* area, const char* explanatory) +OString exceptionToString(const css::uno::Any & caught) { - OString sMessage( "DBG_UNHANDLED_EXCEPTION in " ); - sMessage += currentFunction; - if (explanatory) + auto toOString = [](OUString const & s) { + return OUStringToOString( s, osl_getThreadTextEncoding() ); + }; + OString sMessage = toOString(caught.getValueTypeName()); + css::uno::Exception exception; + caught >>= exception; + if ( !exception.Message.isEmpty() ) + { + sMessage += " message: "; + sMessage += toOString(exception.Message); + } + if ( exception.Context.is() ) + { + const char* pContext = typeid( *exception.Context.get() ).name(); +#if defined __GLIBCXX__ + // demangle the type name, not necessary under windows, we already get demangled names there + int status; + pContext = abi::__cxa_demangle( pContext, nullptr, nullptr, &status); +#endif + sMessage += " context: "; + sMessage += pContext; + } + { + css::configuration::CorruptedConfigurationException specialized; + if ( caught >>= specialized ) { - sMessage += "\n when: "; - sMessage += explanatory; + sMessage += " details: "; + sMessage += toOString(specialized.Details); } - sMessage += "\n type: "; - sMessage += OUStringToOString( caught.getValueTypeName(), osl_getThreadTextEncoding() ); - css::uno::Exception exception; - caught >>= exception; - if ( !exception.Message.isEmpty() ) + } + { + css::configuration::InvalidBootstrapFileException specialized; + if ( caught >>= specialized ) { - sMessage += "\n message: "; - sMessage += OUStringToOString( exception.Message, osl_getThreadTextEncoding() ); + sMessage += " BootstrapFileURL: "; + sMessage += toOString(specialized.BootstrapFileURL); } - if ( exception.Context.is() ) + } + { + css::configuration::MissingBootstrapFileException specialized; + if ( caught >>= specialized ) { - const char* pContext = typeid( *exception.Context.get() ).name(); -#if defined __GLIBCXX__ - // demangle the type name, not necessary under windows, we already get demangled names there - int status; - pContext = abi::__cxa_demangle( pContext, nullptr, nullptr, &status); -#endif - sMessage += "\n context: "; - sMessage += pContext; + sMessage += " BootstrapFileURL: "; + sMessage += toOString(specialized.BootstrapFileURL); } + } + { + css::configuration::backend::MalformedDataException specialized; + if ( caught >>= specialized ) { - css::configuration::CorruptedConfigurationException - specialized; - if ( caught >>= specialized ) - { - sMessage += "\n details: "; - sMessage += OUStringToOString( - specialized.Details, osl_getThreadTextEncoding() ); - } + sMessage += "\n wrapped: "; + sMessage += exceptionToString(specialized.ErrorDetails); } + } + { + css::configuration::backend::BackendSetupException specialized; + if ( caught >>= specialized ) { - css::task::ErrorCodeIOException specialized; - if ( caught >>= specialized ) - { - sMessage += "\n details: "; - sMessage += OString::number( specialized.ErrCode ); - } + sMessage += "\n wrapped: "; + sMessage += exceptionToString(specialized.BackendException); + } + } + { + css::deployment::DependencyException specialized; + if ( caught >>= specialized ) + { + sMessage += " UnsatisfiedDependencies: "; + sMessage += toOString(comphelper::anyToString(css::uno::Any(specialized.UnsatisfiedDependencies))); + } + } + { + css::deployment::DeploymentException specialized; + if ( caught >>= specialized ) + { + sMessage += "\n wrapped: "; + sMessage += exceptionToString(specialized.Cause); + } + } + { + css::document::CorruptedFilterConfigurationException specialized; + if ( caught >>= specialized ) + { + sMessage += " Details: "; + sMessage += toOString(specialized.Details); + } + } + { + css::document::UndoFailedException specialized; + if ( caught >>= specialized ) + { + sMessage += " Reason: "; + sMessage += toOString(comphelper::anyToString(specialized.Reason)); + } + } + { + css::lang::IllegalArgumentException specialized; + if ( caught >>= specialized ) + { + sMessage += " ArgumentPosition: "; + sMessage += OString::number(specialized.ArgumentPosition); + } + } + { + css::lang::WrappedTargetException specialized; + if ( caught >>= specialized ) + { + sMessage += "\n wrapped: "; + sMessage += exceptionToString(specialized.TargetException); + } + } + { + css::lang::WrappedTargetRuntimeException specialized; + if ( caught >>= specialized ) + { + sMessage += "\n wrapped: "; + sMessage += exceptionToString(specialized.TargetException); + } + } + { + css::ldap::LdapGenericException specialized; + if ( caught >>= specialized ) + { + sMessage += " ErrorCode: "; + sMessage += OString::number(specialized.ErrorCode); + } + } + { + css::script::BasicErrorException specialized; + if ( caught >>= specialized ) + { + sMessage += " ErrorCode: "; + sMessage += OString::number(specialized.ErrorCode); + sMessage += " ErrorMessageArgument: "; + sMessage += toOString(specialized.ErrorMessageArgument); + } + } + { + css::script::CannotConvertException specialized; + if ( caught >>= specialized ) + { + sMessage += " DestinationTypeClass: "; + sMessage += toOString(comphelper::anyToString(css::uno::Any(specialized.DestinationTypeClass))); + sMessage += " Reason: "; + sMessage += OString::number(specialized.Reason); + sMessage += " ArgumentIndex: "; + sMessage += OString::number(specialized.ArgumentIndex); + } + } + { + css::script::provider::ScriptErrorRaisedException specialized; + if ( caught >>= specialized ) + { + sMessage += " scriptName: "; + sMessage += toOString(specialized.scriptName); + sMessage += " language: "; + sMessage += toOString(specialized.language); + sMessage += " lineNum: "; + sMessage += OString::number(specialized.lineNum); + } + } + { + css::script::provider::ScriptExceptionRaisedException specialized; + if ( caught >>= specialized ) + { + sMessage += " exceptionType: "; + sMessage += toOString(specialized.exceptionType); + } + } + { + css::script::provider::ScriptFrameworkErrorException specialized; + if ( caught >>= specialized ) + { + sMessage += " scriptName: "; + sMessage += toOString(specialized.scriptName); + sMessage += " language: "; + sMessage += toOString(specialized.language); + sMessage += " errorType: "; + sMessage += OString::number(specialized.errorType); + } + } + { + css::sdbc::SQLException specialized; + if ( caught >>= specialized ) + { + sMessage += " SQLState: "; + sMessage += toOString(specialized.SQLState); + sMessage += " ErrorCode: "; + sMessage += OString::number(specialized.ErrorCode); + sMessage += "\n wrapped: "; + sMessage += exceptionToString(specialized.NextException); + } + } + { + css::system::SystemShellExecuteException specialized; + if ( caught >>= specialized ) + { + sMessage += " PosixError: "; + sMessage += OString::number(specialized.PosixError); + } + } + { + css::task::ErrorCodeIOException specialized; + if ( caught >>= specialized ) + { + sMessage += " errcode: "; + sMessage += OString::number( specialized.ErrCode ); + } + } + { + css::ucb::CommandFailedException specialized; + if ( caught >>= specialized ) + { + sMessage += "\n Reason: "; + sMessage += exceptionToString( specialized.Reason ); + } + } + { + css::ucb::ContentCreationException specialized; + if ( caught >>= specialized ) + { + sMessage += " eError: "; + sMessage += toOString(comphelper::anyToString( css::uno::Any(specialized.eError) )); + } + } + { + css::ucb::MissingPropertiesException specialized; + if ( caught >>= specialized ) + { + sMessage += " Properties: "; + sMessage += toOString(comphelper::anyToString( css::uno::Any(specialized.Properties) )); + } + } + { + css::ucb::NameClashException specialized; + if ( caught >>= specialized ) + { + sMessage += " Name: "; + sMessage += toOString( specialized.Name ); + } + } + { + css::util::MalformedNumberFormatException specialized; + if ( caught >>= specialized ) + { + sMessage += " CheckPos: "; + sMessage += OString::number( specialized.CheckPos ); + } + } + { + css::xml::dom::DOMException specialized; + if ( caught >>= specialized ) + { + sMessage += " Code: "; + sMessage += toOString(comphelper::anyToString( css::uno::Any(specialized.Code) )); + } + } + { + css::xml::dom::DOMException specialized; + if ( caught >>= specialized ) + { + sMessage += " Code: "; + sMessage += toOString(comphelper::anyToString( css::uno::Any(specialized.Code) )); + } + } + { + css::xml::sax::SAXException specialized; + if ( caught >>= specialized ) + { + sMessage += "\n wrapped: "; + sMessage += exceptionToString( specialized.WrappedException ); + } + } + { + css::xml::sax::SAXParseException specialized; + if ( caught >>= specialized ) + { + sMessage += " PublicId: "; + sMessage += toOString( specialized.PublicId ); + sMessage += " SystemId: "; + sMessage += toOString( specialized.SystemId ); + sMessage += " LineNumber: "; + sMessage += OString::number( specialized.LineNumber ); + sMessage += " ColumnNumber: "; + sMessage += OString::number( specialized.ColumnNumber ); + } + } + return sMessage; +} + +void DbgUnhandledException(const css::uno::Any & caught, const char* currentFunction, const char* fileAndLineNo, + const char* area, const char* explanatory) +{ + OString sMessage( "DBG_UNHANDLED_EXCEPTION in " ); + sMessage += currentFunction; + if (explanatory) + { + sMessage += "\n when: "; + sMessage += explanatory; } - sMessage += "\n"; + sMessage += " exception: "; + sMessage += exceptionToString(caught); if (area == nullptr) area = "legacy.osl"; diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx index 80580698d88d..10cc0e1a65f0 100644 --- a/unotools/source/ucbhelper/ucbhelper.cxx +++ b/unotools/source/ucbhelper/ucbhelper.cxx @@ -56,6 +56,7 @@ #include <sal/types.h> #include <tools/datetime.hxx> #include <tools/urlobj.hxx> +#include <tools/diagnose_ex.h> #include <ucbhelper/commandenvironment.hxx> #include <ucbhelper/content.hxx> #include <unotools/ucbhelper.hxx> @@ -102,8 +103,7 @@ std::vector<OUString> getContents(OUString const & url) { css::uno::Any e(cppu::getCaughtException()); SAL_INFO( "unotools.ucbhelper", - "getContents(" << url << ") " << e.getValueType().getTypeName() - << " \"" << e.get<css::uno::Exception>() << '"'); + "getContents(" << url << ") " << exceptionToString(e)); return std::vector<OUString>(); } } @@ -151,8 +151,7 @@ bool utl::UCBContentHelper::IsDocument(OUString const & url) { SAL_INFO( "unotools.ucbhelper", "UCBContentHelper::IsDocument(" << url << ") " - << e.getValueType().getTypeName() << " \"" - << e.get<css::uno::Exception>() << '"'); + << exceptionToString(e)); return false; } } @@ -172,8 +171,7 @@ css::uno::Any utl::UCBContentHelper::GetProperty( SAL_INFO( "unotools.ucbhelper", "UCBContentHelper::GetProperty(" << url << ", " << property << ") " - << e.getValueType().getTypeName() << " \"" - << e.get<css::uno::Exception>() << '"'); + << exceptionToString(e)); return css::uno::Any(); } } @@ -191,8 +189,7 @@ bool utl::UCBContentHelper::IsFolder(OUString const & url) { SAL_INFO( "unotools.ucbhelper", "UCBContentHelper::IsFolder(" << url << ") " - << e.getValueType().getTypeName() << " \"" - << e.get<css::uno::Exception>() << '"'); + << exceptionToString(e)); return false; } } @@ -213,8 +210,7 @@ bool utl::UCBContentHelper::GetTitle( SAL_INFO( "unotools.ucbhelper", "UCBContentHelper::GetTitle(" << url << ") " - << e.getValueType().getTypeName() << " \"" - << e.get<css::uno::Exception>() << '"'); + << exceptionToString(e)); return false; } } @@ -235,8 +231,7 @@ bool utl::UCBContentHelper::Kill(OUString const & url) { SAL_INFO( "unotools.ucbhelper", "UCBContentHelper::Kill(" << url << ") " - << e.getValueType().getTypeName() << " \"" - << e.get<css::uno::Exception>() << '"'); + << exceptionToString(e)); return false; } } @@ -291,8 +286,7 @@ bool utl::UCBContentHelper::MakeFolder( SAL_INFO( "unotools.ucbhelper", "UCBContentHelper::MakeFolder(" << title << ") " - << e.getValueType().getTypeName() << " \"" - << e.get<css::uno::Exception>() << '"'); + << exceptionToString(e)); } if (exists) { INetURLObject o(parent.getURL()); @@ -327,8 +321,7 @@ bool utl::UCBContentHelper::IsYounger( SAL_INFO( "unotools.ucbhelper", "UCBContentHelper::IsYounger(" << younger << ", " << older << ") " - << e.getValueType().getTypeName() << " \"" - << e.get<css::uno::Exception>() << '"'); + << exceptionToString(e)); return false; } } @@ -412,8 +405,7 @@ bool utl::UCBContentHelper::IsSubPath( SAL_INFO( "unotools.ucbhelper", "UCBContentHelper::IsSubPath(" << parent << ", " << child << ") " - << e.getValueType().getTypeName() << " \"" - << e.get<css::uno::Exception>() << '"'); + << exceptionToString(e)); } return false; } diff --git a/vcl/source/app/salusereventlist.cxx b/vcl/source/app/salusereventlist.cxx index 1ccbeea03438..b71b5ed2031a 100644 --- a/vcl/source/app/salusereventlist.cxx +++ b/vcl/source/app/salusereventlist.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/uno/Exception.hpp> #include <cppuhelper/exc_hlp.hxx> #include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include <sal/log.hxx> #include <sal/types.h> #include <svdata.hxx> @@ -109,10 +110,10 @@ bool SalUserEventList::DispatchUserEvents( bool bHandleAllCurrentEvents ) { ProcessEvent( aEvent ); } - catch (css::uno::Exception& e) + catch (css::uno::Exception&) { auto const e2 = cppu::getCaughtException(); - SAL_WARN("vcl", "Uncaught " << e2.getValueTypeName() << " " << e.Message); + SAL_WARN("vcl", "Uncaught " << exceptionToString(e2)); std::abort(); } catch (std::exception& e) diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx index 53d1dafcfd07..39fe10322902 100644 --- a/vcl/source/app/scheduler.cxx +++ b/vcl/source/app/scheduler.cxx @@ -31,6 +31,7 @@ #include <svdata.hxx> #include <tools/time.hxx> #include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include <unotools/configmgr.hxx> #include <vcl/scheduler.hxx> #include <vcl/idle.hxx> @@ -473,10 +474,10 @@ bool Scheduler::ProcessTaskScheduling() { pTask->Invoke(); } - catch (css::uno::Exception& e) + catch (css::uno::Exception&) { - auto const e2 = cppu::getCaughtException(); - SAL_WARN("vcl.schedule", "Uncaught " << e2.getValueTypeName() << " " << e.Message); + auto const ex = cppu::getCaughtException(); + SAL_WARN("vcl.schedule", "Uncaught " << exceptionToString(ex)); std::abort(); } catch (std::exception& e) diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx index 5ffad7b17527..88d70d2132c2 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -43,6 +43,7 @@ #include <unotools/mediadescriptor.hxx> #include <rtl/ref.hxx> #include <sal/log.hxx> +#include <tools/diagnose_ex.h> using namespace ::com::sun::star; @@ -211,7 +212,7 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& rDesc catch (uno::Exception const&) { css::uno::Any anyEx = cppu::getCaughtException(); - SAL_WARN("writerfilter", "WriterFilter::filter(): failed with " << anyEx); + SAL_WARN("writerfilter", "WriterFilter::filter(): failed with " << exceptionToString(anyEx)); throw lang::WrappedTargetRuntimeException("", static_cast<OWeakObject*>(this), anyEx); } diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx index 0e01c2e5872e..c19f566ad286 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx @@ -34,6 +34,7 @@ #include "OOXMLPropertySet.hxx" #include <sal/log.hxx> +#include <tools/diagnose_ex.h> #include <unotools/resmgr.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> @@ -519,7 +520,7 @@ void OOXMLDocumentImpl::resolve(Stream & rStream) catch (uno::Exception const&) { css::uno::Any anyEx = cppu::getCaughtException(); - SAL_WARN("writerfilter.ooxml", "OOXMLDocumentImpl::resolve(): " << anyEx); + SAL_WARN("writerfilter.ooxml", "OOXMLDocumentImpl::resolve(): " << exceptionToString(anyEx)); throw lang::WrappedTargetRuntimeException("", nullptr, anyEx); } catch (...) diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx index 16dffcb51681..d73182609010 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx @@ -31,6 +31,7 @@ #include <cppuhelper/exc_hlp.hxx> #include <sal/log.hxx> +#include <tools/diagnose_ex.h> #include <i18nlangtag/languagetag.hxx> using namespace ::com::sun::star; @@ -541,7 +542,7 @@ void FormattedFieldElement::endElement() catch (const util::MalformedNumberFormatException & exc) { css::uno::Any anyEx = cppu::getCaughtException(); - SAL_WARN( "xmlscript.xmldlg", exc ); + SAL_WARN( "xmlscript.xmldlg", exceptionToString(anyEx) ); // rethrow throw xml::sax::SAXException( exc.Message, Reference< XInterface >(), anyEx ); } |