diff options
39 files changed, 561 insertions, 269 deletions
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 77ce160665d7..3e4808e25453 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 6da728e02f2e..70d0ffc80de8 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 16aa96937f5d..b1cb9b319707 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -846,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 } } @@ -934,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() ) ); } } @@ -1056,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/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 13bba2da95a3..93c082f42002 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> @@ -452,7 +453,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() ) ); } } @@ -503,7 +504,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 8fe6446b50db..89700fe8ec72 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> @@ -2361,10 +2362,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 ); @@ -2490,10 +2491,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 ); @@ -3170,10 +3171,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 ); @@ -3225,10 +3226,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 f29ecfd3ea0a..ac0017f9b974 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" @@ -2241,11 +2242,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 ); @@ -2318,11 +2319,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 ); @@ -2465,11 +2466,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 ); @@ -2532,11 +2533,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 ); @@ -2590,11 +2591,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 ); @@ -2669,11 +2670,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 ); @@ -2722,11 +2723,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 ); @@ -2780,11 +2781,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 ); @@ -2857,11 +2858,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 ); @@ -2942,11 +2943,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 ); @@ -3027,11 +3028,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 ); @@ -3115,11 +3116,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 ); @@ -3199,11 +3200,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 ); @@ -3274,11 +3275,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 ); @@ -3364,11 +3365,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 ); @@ -3464,11 +3465,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 ); @@ -3543,11 +3544,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 ); @@ -3594,11 +3595,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 ); @@ -3658,11 +3659,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 ); @@ -3822,11 +3823,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 ); @@ -3854,11 +3855,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 ); @@ -3891,11 +3892,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 ); @@ -3937,11 +3938,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 ); @@ -3968,11 +3969,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 ); @@ -4040,11 +4041,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 ); @@ -4108,11 +4109,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 ); @@ -4173,11 +4174,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 ); @@ -4194,11 +4195,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 ); @@ -4233,11 +4234,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 ); @@ -4254,11 +4255,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 ); @@ -4291,11 +4292,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 ); @@ -4311,11 +4312,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 ); @@ -4462,11 +4463,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 ), @@ -4520,11 +4521,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 ); @@ -5032,11 +5033,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 ); @@ -5115,11 +5116,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 ); @@ -5171,11 +5172,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 ); @@ -5241,11 +5242,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 ); @@ -5327,11 +5328,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 ); @@ -5396,11 +5397,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 7a3cd8238421..3eae00b4819c 100644 --- a/sd/source/core/CustomAnimationCloner.cxx +++ b/sd/source/core/CustomAnimationCloner.cxx @@ -36,6 +36,8 @@ #include <cppuhelper/exc_hlp.hxx> #include <rtl/ref.hxx> #include <sal/log.hxx> +#include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include <animations/animationnodehelper.hxx> #include <svx/svditer.hxx> @@ -123,7 +125,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 +202,7 @@ namespace sd { SAL_WARN( "sd", "sd::CustomAnimationClonerImpl::transformNode(), " "exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -271,7 +273,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 a8afa9567e42..0344c277ee10 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> @@ -3058,7 +3059,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; @@ -3109,7 +3110,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 042a63006f78..04b50f9a3936 100644 --- a/sd/source/ui/remotecontrol/Receiver.cxx +++ b/sd/source/ui/remotecontrol/Receiver.cxx @@ -22,6 +22,8 @@ #include <rtl/strbuf.hxx> #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; @@ -146,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 @@ -160,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" ); @@ -179,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" ); @@ -204,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 f8b049c28b35..96b108113543 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -38,6 +38,7 @@ #include <svl/urihelper.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <tools/diagnose_ex.h> #include <sfx2/infobar.hxx> #include <sfx2/request.hxx> @@ -312,7 +313,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; @@ -605,7 +606,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(); @@ -819,7 +820,7 @@ bool SlideshowImpl::startPreview( catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::startPreview(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); bRet = false; } @@ -1019,7 +1020,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; } @@ -1089,7 +1090,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; } } @@ -1123,7 +1124,7 @@ void SlideshowImpl::paint() catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::paint(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -1198,7 +1199,7 @@ void SlideshowImpl::removeShapeEvents() catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::removeShapeEvents(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -1227,7 +1228,7 @@ void SlideshowImpl::registerShapeEvents(sal_Int32 nSlideNumber) catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::registerShapeEvents(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -1299,7 +1300,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() ) ); } } @@ -1365,7 +1366,7 @@ void SAL_CALL SlideshowImpl::pause() catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::pause(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -1395,7 +1396,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 ); @@ -1703,7 +1704,7 @@ void SlideshowImpl::updateSlideShow() catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::updateSlideShow(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -1828,7 +1829,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; @@ -2209,7 +2210,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; @@ -2390,7 +2391,7 @@ void SlideshowImpl::resize( const Size& rSize ) catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::resize(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -2654,7 +2655,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() ) ); } } @@ -2699,7 +2700,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() )); } } } @@ -2897,7 +2898,7 @@ void SlideshowImpl::gotoPreviousSlide (const bool bSkipAllMainSequenceEffects) catch( Exception& ) { SAL_WARN( "sd", "sd::SlideshowImpl::gotoPreviousSlide(), exception caught: " - << comphelper::anyToString( cppu::getCaughtException() ) ); + << exceptionToString( cppu::getCaughtException() ) ); } } @@ -2982,7 +2983,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 5a18278f635a..f8d688959e07 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> @@ -249,7 +250,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 8eadd83428e8..a508ecb0067a 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> @@ -123,7 +122,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 0b7dae6bc70b..cfcd3be54853 100644 --- a/slideshow/source/engine/animationnodes/animationbasenode.cxx +++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx @@ -209,7 +209,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 e1c53c4da4f6..4277677dcda8 100644 --- a/slideshow/source/engine/eventqueue.cxx +++ b/slideshow/source/engine/eventqueue.cxx @@ -238,7 +238,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 52c453e3eea6..daa62e61942e 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 c2aa3a695765..f46f82269f66 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 029c2a52fbc2..27c2bfe43d6d 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 84d7e363d339..70a37e8c6394 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() ) ); } } } @@ -482,7 +482,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 333412d90029..c13120ef1958 100644 --- a/slideshow/source/engine/slide/layermanager.cxx +++ b/slideshow/source/engine/slide/layermanager.cxx @@ -622,7 +622,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 8c6be3eeb99f..4a08319eca36 100644 --- a/slideshow/source/engine/slide/slideanimations.cxx +++ b/slideshow/source/engine/slide/slideanimations.cxx @@ -55,7 +55,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 ee119ce4549d..8f721d0d07f6 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -773,7 +773,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 } @@ -1031,7 +1031,7 @@ bool SlideImpl::loadShapes() } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); return false; } } @@ -1070,7 +1070,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 9b7eadb65cd6..41bd954fc197 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -2083,7 +2083,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 2f19fca124b9..ddee95a3eaea 100644 --- a/slideshow/source/engine/soundplayer.cxx +++ b/slideshow/source/engine/soundplayer.cxx @@ -121,7 +121,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 b232f42aa5b5..34cff4a15c8f 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 fe3d29363942..431a9bc77c66 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 0b8fac18ca8f..e642cfdc610c 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> @@ -867,8 +868,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() ) ); } } @@ -901,8 +902,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() ) ); } } } @@ -1018,8 +1019,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() ) ); } } } @@ -1082,8 +1083,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() ) ); } } } @@ -1160,8 +1161,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; @@ -1741,8 +1742,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 b360919f570a..e41296da55a0 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 ed66602ca549..b71b5ed2031a 100644 --- a/vcl/source/app/salusereventlist.cxx +++ b/vcl/source/app/salusereventlist.cxx @@ -27,6 +27,8 @@ #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> @@ -108,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 e647cab8de65..80d4b1b9e4ce 100644 --- a/vcl/source/app/scheduler.cxx +++ b/vcl/source/app/scheduler.cxx @@ -30,6 +30,8 @@ #include <sal/types.h> #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 +475,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 08bc0c420ec7..c23e96186921 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; @@ -206,7 +207,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 8f0ad98c9702..7b0148edc4c9 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 239f795e426a..ddc19789f2c6 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 ); } |