diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-09-26 21:58:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-09-27 09:50:31 +0200 |
commit | 960252e129bb72e10790672a5650c0ce24e0f1e0 (patch) | |
tree | 2fbd8842a2dd3c1aa88656a83ccd975419985e74 /package | |
parent | e0ce9ec1a543d5cbb91d061db067847052bf9c7e (diff) |
improve some exception messages
Change-Id: Ifc5d940fbf77ae13071c299fb6168bdc55dc5c95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103493
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'package')
-rw-r--r-- | package/source/xstor/ocompinstream.cxx | 2 | ||||
-rw-r--r-- | package/source/xstor/ohierarchyholder.cxx | 4 | ||||
-rw-r--r-- | package/source/xstor/owriteablestream.cxx | 20 | ||||
-rw-r--r-- | package/source/xstor/switchpersistencestream.cxx | 2 |
4 files changed, 14 insertions, 14 deletions
diff --git a/package/source/xstor/ocompinstream.cxx b/package/source/xstor/ocompinstream.cxx index 8f15962d3bf0..17092d9a54cd 100644 --- a/package/source/xstor/ocompinstream.cxx +++ b/package/source/xstor/ocompinstream.cxx @@ -413,7 +413,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OInputCompStream::g return aResult; } - throw io::IOException(); // the relations info could not be read + throw io::IOException("relations info could not be read"); // the relations info could not be read } void SAL_CALL OInputCompStream::insertRelationshipByID( const OUString& /*sID*/, const uno::Sequence< beans::StringPair >& /*aEntry*/, sal_Bool /*bReplace*/ ) diff --git a/package/source/xstor/ohierarchyholder.cxx b/package/source/xstor/ohierarchyholder.cxx index 58ec912869a2..e2f629fa809a 100644 --- a/package/source/xstor/ohierarchyholder.cxx +++ b/package/source/xstor/ohierarchyholder.cxx @@ -40,7 +40,7 @@ uno::Reference< embed::XExtendedStorageStream > OHierarchyHolder_Impl::GetStream uno::Reference< embed::XStorage > xOwnStor( m_xWeakOwnStorage.get(), uno::UNO_QUERY_THROW ); if ( !( nStorageMode & embed::ElementModes::WRITE ) && ( nStreamMode & embed::ElementModes::WRITE ) ) - throw io::IOException(); + throw io::IOException("invalid storage/stream mode combo"); uno::Reference< embed::XExtendedStorageStream > xResult = m_xChild->GetStreamHierarchically( nStorageMode, aListPath, nStreamMode, aEncryptionData ); @@ -82,7 +82,7 @@ uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStrea ::osl::MutexGuard aGuard( m_aMutex ); if ( !( nStorageMode & embed::ElementModes::WRITE ) && ( nStreamMode & embed::ElementModes::WRITE ) ) - throw io::IOException(); + throw io::IOException("invalid storage/stream mode combo"); if ( aListPath.empty() ) throw uno::RuntimeException(); diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index ac97214b7a1e..408003386ea2 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -119,10 +119,10 @@ void SetEncryptionKeyProperty_Impl( const uno::Reference< beans::XPropertySet >& try { xPropertySet->setPropertyValue( STORAGE_ENCRYPTION_KEYS_PROPERTY, uno::makeAny( aKey ) ); } - catch ( const uno::Exception& ) + catch ( const uno::Exception& ex ) { TOOLS_WARN_EXCEPTION( "package.xstor", "Can't write encryption related properties"); - throw io::IOException(); // TODO + throw io::IOException(ex.Message); // TODO } } @@ -135,10 +135,10 @@ uno::Any GetEncryptionKeyProperty_Impl( const uno::Reference< beans::XPropertySe try { return xPropertySet->getPropertyValue(STORAGE_ENCRYPTION_KEYS_PROPERTY); } - catch ( const uno::Exception& ) + catch ( const uno::Exception& ex ) { TOOLS_WARN_EXCEPTION( "package.xstor", "Can't get encryption related properties"); - throw io::IOException(); // TODO + throw io::IOException(ex.Message); // TODO } } @@ -503,7 +503,7 @@ OUString const & OWriteStream_Impl::GetFilledTempFileIfNo( const uno::Reference< uno::Reference< io::XOutputStream > xTempOutStream = xTempAccess->openFileWrite( aTempURL ); if ( !xTempOutStream.is() ) - throw io::IOException(); // TODO: + throw io::IOException("no temp stream"); // TODO: // the current position of the original stream should be still OK, copy further ::comphelper::OStorageHelper::CopyInputToOutput( xStream, xTempOutStream ); xTempOutStream->closeOutput(); @@ -579,7 +579,7 @@ OUString const & OWriteStream_Impl::FillTempGetFileName() uno::Reference< io::XOutputStream > xTempOutStream = xTempAccess->openFileWrite( m_aTempURL ); if ( !xTempOutStream.is() ) - throw io::IOException(); // TODO: + throw io::IOException("no temp stream"); // TODO: // copy stream contents to the file xTempOutStream->writeBytes( aData ); @@ -641,7 +641,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetTempFileAsStream() // in case the stream can not be open // an exception should be thrown if ( !xTempStream.is() ) - throw io::IOException(); //TODO: + throw io::IOException("no temp stream"); //TODO: return xTempStream; } @@ -695,7 +695,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt SAL_WARN_IF( !m_xPackageStream.is(), "package.xstor", "No package stream is set!" ); if ( m_bHasDataToFlush ) - throw io::IOException(); + throw io::IOException("m_bHasDataToFlush==true"); OSL_ENSURE( m_aTempURL.isEmpty() && !m_xCacheStream.is(), "The temporary must not exist!" ); @@ -1169,11 +1169,11 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() ); throw; } - catch ( const uno::Exception& ) + catch ( const uno::Exception& ex ) { TOOLS_WARN_EXCEPTION( "package.xstor", "Can't write encryption related properties"); SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() ); - throw io::IOException(); // TODO: + throw io::IOException(ex.Message); // TODO: } } diff --git a/package/source/xstor/switchpersistencestream.cxx b/package/source/xstor/switchpersistencestream.cxx index 7eac83cbf708..459f498fb98b 100644 --- a/package/source/xstor/switchpersistencestream.cxx +++ b/package/source/xstor/switchpersistencestream.cxx @@ -164,7 +164,7 @@ void SwitchablePersistenceStream::CopyAndSwitchPersistenceTo( const uno::Referen // the provided stream must be empty xTargetSeek.set( xTargetStream, uno::UNO_QUERY_THROW ); if ( xTargetSeek->getLength() ) - throw io::IOException(); + throw io::IOException("provided stream not empty"); } uno::Reference< io::XTruncate > xTargetTruncate( xTargetStream, uno::UNO_QUERY_THROW ); |