summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-10-09 19:23:35 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-10-09 21:02:11 +0200
commitf58ee783eebf74108c1c1dd5f24e6abaa19c4f09 (patch)
tree34b7ebcb305f4d5b2e54f428fb7acf0e3156d36d /sfx2
parent669655d146ea87db2df28125b02bcfdfe4ef61d7 (diff)
Improve ErrorCodeIOException messages
...and clean up some includes. Change-Id: Ia5843cd38f967722d7173a6c87fba26064e3ffd6
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/DocumentMetadataAccess.cxx6
-rw-r--r--sfx2/source/doc/SfxDocumentMetaData.cxx6
-rw-r--r--sfx2/source/doc/guisaveas.cxx66
-rw-r--r--sfx2/source/doc/objserv.cxx7
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx43
-rw-r--r--sfx2/source/view/ipclient.cxx1
6 files changed, 81 insertions, 48 deletions
diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx
index 623aa843ea91..e3d71f9cc823 100644
--- a/sfx2/source/doc/DocumentMetadataAccess.cxx
+++ b/sfx2/source/doc/DocumentMetadataAccess.cxx
@@ -1382,8 +1382,10 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
if ( nError == ERRCODE_NONE ) {
nError = ERRCODE_IO_GENERAL;
}
- task::ErrorCodeIOException ex( OUString(),
- uno::Reference< uno::XInterface >(), nError);
+ task::ErrorCodeIOException ex(
+ ("DocumentMetadataAccess::storeMetadataToMedium Commit failed: "
+ "0x" + OUString::number(nError, 16)),
+ uno::Reference< uno::XInterface >(), nError);
throw lang::WrappedTargetException(OUString(), *this,
uno::makeAny(ex));
}
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 4e89b6ac1625..5bdcc7ec9a70 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -2118,8 +2118,10 @@ SfxDocumentMetaData::storeToMedium(const OUString & URL,
nError = ERRCODE_IO_GENERAL;
}
- throw css::task::ErrorCodeIOException( OUString(),
- css::uno::Reference< css::uno::XInterface >(), nError);
+ throw css::task::ErrorCodeIOException(
+ ("SfxDocumentMetaData::storeToMedium <" + URL + "> Commit failed: "
+ "0x" + OUString::number(nError, 16)),
+ css::uno::Reference< css::uno::XInterface >(), nError);
}
}
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index f8f880540b15..79af8ed1b006 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
@@ -152,9 +153,10 @@ static sal_uInt8 getStoreModeFromSlotName( const OUString& aSlotName )
else if ( aSlotName == "SaveAs" )
nResult = SAVEAS_REQUESTED;
else
- throw task::ErrorCodeIOException( OUString(),
- uno::Reference< uno::XInterface >(),
- ERRCODE_IO_INVALIDPARAMETER );
+ throw task::ErrorCodeIOException(
+ ("getStoreModeFromSlotName(\"" + aSlotName
+ + "): ERRCODE_IO_INVALIDPARAMETER"),
+ uno::Reference< uno::XInterface >(), ERRCODE_IO_INVALIDPARAMETER );
return nResult;
}
@@ -609,9 +611,11 @@ sal_Bool ModelData_Impl::ExecuteFilterDialog_Impl( const OUString& aFilterName )
}
else
{
- throw task::ErrorCodeIOException( OUString(),
- uno::Reference< uno::XInterface >(),
- ERRCODE_IO_ABORT );
+ throw task::ErrorCodeIOException(
+ ("ModelData_Impl::ExecuteFilterDialog_Impl:"
+ " ERRCODE_IO_ABORT"),
+ uno::Reference< uno::XInterface >(),
+ ERRCODE_IO_ABORT);
}
}
}
@@ -621,12 +625,13 @@ sal_Bool ModelData_Impl::ExecuteFilterDialog_Impl( const OUString& aFilterName )
}
}
}
- catch( const container::NoSuchElementException& )
+ catch( const container::NoSuchElementException& e )
{
// the filter name is unknown
- throw task::ErrorCodeIOException( OUString(),
- uno::Reference< uno::XInterface >(),
- ERRCODE_IO_INVALIDPARAMETER );
+ throw task::ErrorCodeIOException(
+ ("ModelData_Impl::ExecuteFilterDialog_Impl: NoSuchElementException"
+ " \"" + e.Message + "\": ERRCODE_IO_ABORT"),
+ uno::Reference< uno::XInterface >(), ERRCODE_IO_INVALIDPARAMETER);
}
catch( const task::ErrorCodeIOException& )
{
@@ -870,9 +875,10 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode,
// the file name must be specified if overwrite option is set
if ( aOverwriteIter != GetMediaDescr().end() )
- throw task::ErrorCodeIOException( OUString(),
- uno::Reference< uno::XInterface >(),
- ERRCODE_IO_INVALIDPARAMETER );
+ throw task::ErrorCodeIOException(
+ "ModelData_Impl::OutputFileDialog: ERRCODE_IO_INVALIDPARAMETER",
+ uno::Reference< uno::XInterface >(),
+ ERRCODE_IO_INVALIDPARAMETER);
// no target file name is specified
// we need to show the file dialog
@@ -1053,7 +1059,9 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode,
OUString aStringTypeFN;
if ( pFileDlg->Execute( pDialogParams, aStringTypeFN ) != ERRCODE_NONE )
{
- throw task::ErrorCodeIOException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT );
+ throw task::ErrorCodeIOException(
+ "ModelData_Impl::OutputFileDialog: ERRCODE_IO_ABORT",
+ uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT);
}
OUString aFilterName = aStringTypeFN;
@@ -1378,7 +1386,9 @@ sal_Bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel
// if saving is not acceptable the warning must be shown even in case of SaveAs operation
if ( ( nStoreMode & SAVEAS_REQUESTED ) && aModelData.CheckSaveAcceptable( STATUS_SAVEAS ) == STATUS_NO_ACTION )
- throw task::ErrorCodeIOException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT );
+ throw task::ErrorCodeIOException(
+ "SfxStoringHelper::GUIStoreModel: ERRCODE_IO_ABORT",
+ uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT);
}
else if ( nStoreMode & SAVE_REQUESTED )
{
@@ -1386,7 +1396,9 @@ sal_Bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel
nStatusSave = aModelData.CheckSaveAcceptable( STATUS_SAVE );
if ( nStatusSave == STATUS_NO_ACTION )
- throw task::ErrorCodeIOException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT );
+ throw task::ErrorCodeIOException(
+ "SfxStoringHelper::GUIStoreModel: ERRCODE_IO_ABORT",
+ uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT);
else if ( nStatusSave == STATUS_SAVE )
{
// check whether it is possible to use save operation
@@ -1395,7 +1407,9 @@ sal_Bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel
if ( nStatusSave == STATUS_NO_ACTION )
{
- throw task::ErrorCodeIOException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT );
+ throw task::ErrorCodeIOException(
+ "SfxStoringHelper::GUIStoreModel: ERRCODE_IO_ABORT",
+ uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT);
}
else if ( nStatusSave != STATUS_SAVE )
{
@@ -1417,9 +1431,9 @@ sal_Bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel
if ( QueryBox( NULL, SfxResId( RID_XMLSEC_QUERY_LOSINGSIGNATURE ) ).Execute() != RET_YES )
{
// the user has decided not to store the document
- throw task::ErrorCodeIOException( OUString(),
- uno::Reference< uno::XInterface >(),
- ERRCODE_IO_ABORT );
+ throw task::ErrorCodeIOException(
+ "SfxStoringHelper::GUIStoreModel: ERRCODE_IO_ABORT",
+ uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT);
}
}
}
@@ -1456,9 +1470,9 @@ sal_Bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel
DBG_ASSERT( aFilterProps.getLength(), "No filter for storing!\n" );
if ( !aFilterProps.getLength() )
- throw task::ErrorCodeIOException( OUString(),
- uno::Reference< uno::XInterface >(),
- ERRCODE_IO_INVALIDPARAMETER );
+ throw task::ErrorCodeIOException(
+ "SfxStoringHelper::GUIStoreModel: ERRCODE_IO_INVALIDPARAMETER",
+ uno::Reference< uno::XInterface >(), ERRCODE_IO_INVALIDPARAMETER);
::comphelper::SequenceAsHashMap aFilterPropsHM( aFilterProps );
OUString aFilterName = aFilterPropsHM.getUnpackedValueOrDefault(
@@ -1607,9 +1621,9 @@ sal_Bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel
else
{
DBG_ASSERT( sal_False, "This code must be unreachable!\n" );
- throw task::ErrorCodeIOException( OUString(),
- uno::Reference< uno::XInterface >(),
- ERRCODE_IO_INVALIDPARAMETER );
+ throw task::ErrorCodeIOException(
+ "SfxStoringHelper::GUIStoreModel: ERRCODE_IO_INVALIDPARAMETER",
+ uno::Reference< uno::XInterface >(), ERRCODE_IO_INVALIDPARAMETER);
}
::comphelper::SequenceAsHashMap::const_iterator aIter =
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 3a2ce2e7eb20..2fe263e2357f 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/document/XCmisDocument.hpp>
#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
@@ -692,9 +693,9 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
else
{
// the user has decided not to store the document
- throw task::ErrorCodeIOException( OUString(),
- uno::Reference< uno::XInterface >(),
- ERRCODE_IO_ABORT );
+ throw task::ErrorCodeIOException(
+ "SfxObjectShell::ExecFile_Impl: ERRCODE_IO_ABORT",
+ uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT);
}
// merge aDispatchArgs to the request
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index d7776594321d..e7888a4c6069 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -22,6 +22,7 @@
#include <sfx2/sfxbasemodel.hxx>
#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/task/ErrorCodeRequest.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/view/XPrintJobListener.hpp>
@@ -1660,7 +1661,9 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue >
// write the contents of the logger to the file
SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCFAILED, GlobalEventConfig::GetEventName(STR_EVENT_SAVEDOCFAILED), m_pData->m_pObjectShell ) );
- throw task::ErrorCodeIOException( OUString(), Reference< XInterface >(), nErrCode );
+ throw task::ErrorCodeIOException(
+ "SfxBaseModel::storeSelf: 0x" + OUString::number(nErrCode, 16),
+ Reference< XInterface >(), nErrCode);
}
}
@@ -1807,7 +1810,9 @@ void SAL_CALL SfxBaseModel::initNew()
m_pData->m_pObjectShell->ResetError();
if ( !bRes )
- throw task::ErrorCodeIOException( OUString(), Reference< XInterface >(), nErrCode );
+ throw task::ErrorCodeIOException(
+ "SfxBaseModel::initNew: 0x" + OUString::number(nErrCode, 16),
+ Reference< XInterface >(), nErrCode);
}
}
@@ -2733,9 +2738,10 @@ void SfxBaseModel::handleLoadError( sal_uInt32 nError, SfxMedium* pMedium )
if ( !bWarning ) // #i30711# don't abort loading if it's only a warning
{
- throw task::ErrorCodeIOException( OUString(),
- Reference< XInterface >(),
- nError ? nError : ERRCODE_IO_CANTREAD );
+ nError = nError ? nError : ERRCODE_IO_CANTREAD;
+ throw task::ErrorCodeIOException(
+ "SfxBaseModel::handleLoadError: 0x" + OUString::number(nError, 16),
+ Reference< XInterface >(), nError);
}
}
@@ -3158,7 +3164,10 @@ void SfxBaseModel::impl_store( const OUString& sURL
SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED, GlobalEventConfig::GetEventName( bSaveTo ? STR_EVENT_SAVETODOCFAILED : STR_EVENT_SAVEASDOCFAILED),
m_pData->m_pObjectShell ) );
- throw task::ErrorCodeIOException( OUString(), Reference< XInterface >(), nErrCode );
+ throw task::ErrorCodeIOException(
+ ("SfxBaseModel::impl_store <" + sURL + "> failed: 0x"
+ + OUString::number(nErrCode, 16)),
+ Reference< XInterface >(), nErrCode);
}
}
}
@@ -3781,9 +3790,10 @@ void SAL_CALL SfxBaseModel::loadFromStorage( const Reference< embed::XStorage >&
if ( !m_pData->m_pObjectShell->DoLoad(pMedium) )
{
sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode();
- throw task::ErrorCodeIOException( OUString(),
- Reference< XInterface >(),
- nError ? nError : ERRCODE_IO_CANTREAD );
+ nError = nError ? nError : ERRCODE_IO_CANTREAD;
+ throw task::ErrorCodeIOException(
+ "SfxBaseModel::loadFromStorage: 0x" + OUString::number(nError, 16),
+ Reference< XInterface >(), nError);
}
loadCmisProperties( );
}
@@ -3844,9 +3854,10 @@ void SAL_CALL SfxBaseModel::storeToStorage( const Reference< embed::XStorage >&
// the warnings are currently not transported
if ( !bSuccess )
{
- throw task::ErrorCodeIOException( OUString(),
- Reference< XInterface >(),
- nError ? nError : ERRCODE_IO_GENERAL );
+ nError = nError ? nError : ERRCODE_IO_GENERAL;
+ throw task::ErrorCodeIOException(
+ "SfxBaseModel::storeToStorage: 0x" + OUString::number(nError, 16),
+ Reference< XInterface >(), nError);
}
}
@@ -3868,9 +3879,11 @@ void SAL_CALL SfxBaseModel::switchToStorage( const Reference< embed::XStorage >&
if ( !m_pData->m_pObjectShell->SwitchPersistance( xStorage ) )
{
sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode();
- throw task::ErrorCodeIOException( OUString(),
- Reference< XInterface >(),
- nError ? nError : ERRCODE_IO_GENERAL );
+ nError = nError ? nError : ERRCODE_IO_GENERAL;
+ throw task::ErrorCodeIOException(
+ ("SfxBaseModel::switchToStorage: 0x"
+ + OUString::number(nError, 16)),
+ Reference< XInterface >(), nError);
}
else
{
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index d3c5989fac83..19d61a51304f 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/embed/StateChangeInProgressException.hpp>
#include <com/sun/star/embed/XLinkageSupport.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/task/StatusIndicatorFactory.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>