diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-01-18 15:05:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-20 09:03:45 +0100 |
commit | bca1b74c0753f2305a5e234293df88aa3e1d9af0 (patch) | |
tree | 16732572c6e15dbd5a2f4e50a2451efc836e3a2d /basic/source/uno | |
parent | 35a564864e6ce08abfa4924e1ea9314982e7957c (diff) |
improve some IllegalArgumentException messages
Change-Id: Id88f2a82bf2651e8b5895aa330f32b71ff5b0e48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109546
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic/source/uno')
-rw-r--r-- | basic/source/uno/namecont.cxx | 21 | ||||
-rw-r--r-- | basic/source/uno/scriptcont.cxx | 4 |
2 files changed, 13 insertions, 12 deletions
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index dc83ae5a3546..61b62632ef6f 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -141,7 +141,7 @@ void NameContainer::replaceByName( const OUString& aName, const Any& aElement ) const Type& aAnyType = aElement.getValueType(); if( mType != aAnyType ) { - throw IllegalArgumentException(); + throw IllegalArgumentException("types do not match", static_cast<cppu::OWeakObject*>(this), 2); } NameContainerNameMap::iterator aIt = mHashMap.find( aName ); if( aIt == mHashMap.end() ) @@ -195,7 +195,7 @@ void NameContainer::insertNoCheck(const OUString& aName, const Any& aElement) const Type& aAnyType = aElement.getValueType(); if( mType != aAnyType ) { - throw IllegalArgumentException(); + throw IllegalArgumentException("types do not match", static_cast<cppu::OWeakObject*>(this), 2); } sal_Int32 nCount = mNames.size(); @@ -435,7 +435,7 @@ void SAL_CALL SfxLibraryContainer::setRootStorage( const Reference< XStorage >& LibraryContainerMethodGuard aGuard( *this ); if ( !_rxRootStorage.is() ) { - throw IllegalArgumentException(); + throw IllegalArgumentException("no root storage", static_cast<cppu::OWeakObject*>(this), 1); } mxStorage = _rxRootStorage; onNewRootStorage(); @@ -446,7 +446,7 @@ void SAL_CALL SfxLibraryContainer::storeLibrariesToStorage( const Reference< XSt LibraryContainerMethodGuard aGuard( *this ); if ( !_rxRootStorage.is() ) { - throw IllegalArgumentException(); + throw IllegalArgumentException("no root storage", static_cast<cppu::OWeakObject*>(this), 1); } try { @@ -2221,7 +2221,7 @@ void SAL_CALL SfxLibraryContainer::removeLibrary( const OUString& Name ) SfxLibrary* pImplLib = static_cast< SfxLibrary* >( xNameAccess.get() ); if( pImplLib->mbReadOnly && !pImplLib->mbLink ) { - throw IllegalArgumentException(); + throw IllegalArgumentException("readonly && !link", static_cast<cppu::OWeakObject*>(this), 1); } // Remove from container maNameContainer->removeByName( Name ); @@ -2444,7 +2444,7 @@ OUString SAL_CALL SfxLibraryContainer::getLibraryLinkURL( const OUString& Name ) bool bLink = pImplLib->mbLink; if( !bLink ) { - throw IllegalArgumentException(); + throw IllegalArgumentException("!link", static_cast<cppu::OWeakObject*>(this), 1); } OUString aRetStr = pImplLib->maLibInfoFileURL; return aRetStr; @@ -2631,9 +2631,10 @@ void SAL_CALL SfxLibraryContainer::initialize( const Sequence< Any >& _rArgument initializeFromDocument( xDocument ); return; } + throw IllegalArgumentException("arg1 unknown type", static_cast<cppu::OWeakObject*>(this), 1); } - - throw IllegalArgumentException(); + else + throw IllegalArgumentException("too many args", static_cast<cppu::OWeakObject*>(this), -1); } void SfxLibraryContainer::initializeFromDocument( const Reference< XStorageBasedDocument >& _rxDocument ) @@ -2657,7 +2658,7 @@ void SfxLibraryContainer::initializeFromDocument( const Reference< XStorageBased if ( !xDocStorage.is() ) { - throw IllegalArgumentException(); + throw IllegalArgumentException("no doc storage", static_cast<cppu::OWeakObject*>(this), 1); } init( OUString(), xDocStorage ); } @@ -2783,7 +2784,7 @@ OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString bool bLink = pImplLib->mbLink; if( !bLink ) { - throw IllegalArgumentException(); + throw IllegalArgumentException("!link", static_cast<cppu::OWeakObject*>(this), 1); } OUString aRetStr = pImplLib->maOriginalStorageURL; return aRetStr; diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index 652a7fbc3129..40c9c40ce6bc 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -350,7 +350,7 @@ sal_Bool SAL_CALL SfxScriptLibraryContainer::isLibraryPasswordVerified( const OU SfxLibrary* pImplLib = getImplLib( Name ); if( !pImplLib->mbPasswordProtected ) { - throw IllegalArgumentException(); + throw IllegalArgumentException("!passwordProtected", static_cast<cppu::OWeakObject*>(this), 1); } bool bRet = pImplLib->mbPasswordVerified; return bRet; @@ -363,7 +363,7 @@ sal_Bool SAL_CALL SfxScriptLibraryContainer::verifyLibraryPassword SfxLibrary* pImplLib = getImplLib( Name ); if( !pImplLib->mbPasswordProtected || pImplLib->mbPasswordVerified ) { - throw IllegalArgumentException(); + throw IllegalArgumentException("!PasswordProtected || PasswordVerified", static_cast<cppu::OWeakObject*>(this), 1); } // Test password bool bSuccess = false; |