sw/source/core/unocore/unosett.cxx |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit dbccdea9744c5400a5dad908bce5d2973ac60f3c
Author:     Ashok <ashokemai...@yahoo.com>
AuthorDate: Thu Sep 19 14:48:20 2024 -0700
Commit:     Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
CommitDate: Wed Sep 25 09:29:41 2024 +0200

    tdf#42982 Improve Error Messages with RuntimeException in UNO API
    
    Improved UNO API RuntimeException to return descriptive message.
    
    Change-Id: Idae14c2ae095270c30b86cfad64936ccead5e4d5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173686
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
    Tested-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>

diff --git a/sw/source/core/unocore/unosett.cxx 
b/sw/source/core/unocore/unosett.cxx
index 8d9d42b6c200..99f6e0ac1754 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -283,7 +283,7 @@ void SwXFootnoteProperties::setPropertyValue(const 
OUString& rPropertyName, cons
 {
     SolarMutexGuard aGuard;
     if(!m_pDoc)
-        throw uno::RuntimeException();
+        throw uno::RuntimeException(u"Footnote's document is not set."_ustr);
 
     const SfxItemPropertyMapEntry*  pEntry = 
m_pPropertySet->getPropertyMap().getByName( rPropertyName );
     if(!pEntry)
@@ -404,7 +404,7 @@ uno::Any SwXFootnoteProperties::getPropertyValue(const 
OUString& rPropertyName)
     SolarMutexGuard aGuard;
     uno::Any aRet;
     if(!m_pDoc)
-        throw uno::RuntimeException();
+        throw uno::RuntimeException(u"Footnote's document is not set."_ustr);
 
     const SfxItemPropertyMapEntry*  pEntry = 
m_pPropertySet->getPropertyMap().getByName( rPropertyName );
     if(!pEntry)
@@ -765,7 +765,7 @@ void SwXLineNumberingProperties::setPropertyValue(
 {
     SolarMutexGuard aGuard;
     if(!m_pDoc)
-        throw uno::RuntimeException();
+        throw uno::RuntimeException(u"Numbering's document is not set."_ustr);
 
     const SfxItemPropertyMapEntry*  pEntry = 
m_pPropertySet->getPropertyMap().getByName( rPropertyName );
     if(!pEntry)
@@ -879,7 +879,7 @@ Any SwXLineNumberingProperties::getPropertyValue(const 
OUString& rPropertyName)
     SolarMutexGuard aGuard;
     Any aRet;
     if(!m_pDoc)
-        throw uno::RuntimeException();
+        throw uno::RuntimeException(u"Numbering's document is not set."_ustr);
 
     const SfxItemPropertyMapEntry*  pEntry = 
m_pPropertySet->getPropertyMap().getByName( rPropertyName );
     if(!pEntry)
@@ -1191,7 +1191,7 @@ uno::Any SwXNumberingRules::getByIndex(sal_Int32 nIndex)
         aVal <<= aRet;
     }
     else
-        throw uno::RuntimeException();
+        throw uno::RuntimeException(u"Could not get numbering rule."_ustr);
     return aVal;
 }
 
@@ -2206,7 +2206,7 @@ void SwXNumberingRules::setPropertyValue( const OUString& 
rPropertyName, const A
 
     }
     if(!m_pNumRule && !pDocRule && !pCreatedRule)
-        throw RuntimeException();
+        throw RuntimeException(u"Could not set numbering rule property 
\'"_ustr + rPropertyName + u"\'."_ustr);
 
     if(rPropertyName == UNO_NAME_IS_AUTOMATIC)
     {
@@ -2265,7 +2265,7 @@ Any SwXNumberingRules::getPropertyValue( const OUString& 
rPropertyName )
     else if(m_pDoc && !m_sCreatedNumRuleName.isEmpty())
         pRule = m_pDoc->FindNumRulePtr( m_sCreatedNumRuleName );
     if(!pRule)
-        throw RuntimeException();
+        throw RuntimeException(u"Could not get numbering rule property 
\'"_ustr + rPropertyName + u"\'."_ustr);
 
     if(rPropertyName == UNO_NAME_IS_AUTOMATIC)
     {

Reply via email to