i18npool/source/breakiterator/breakiterator_unicode.cxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit a97ceaf14e294373b864c61c930f8723e13747c7
Author:     Ankit_Jaipuriar <ankitjaipuria...@gmail.com>
AuthorDate: Sun Sep 24 11:49:28 2023 +0530
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Oct 13 20:00:19 2023 +0200

    tdf#42982 Improved UNO API error reporting
    
    Change-Id: I62862c8dd83b587e56177afd2ec05af1f567f6ff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157201
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx 
b/i18npool/source/breakiterator/breakiterator_unicode.cxx
index 7e19e863bc70..4927a82293fc 100644
--- a/i18npool/source/breakiterator/breakiterator_unicode.cxx
+++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx
@@ -146,7 +146,8 @@ void BreakIterator_Unicode::loadICUBreakIterator(const 
css::lang::Locale& rLocal
 
                 status = U_ZERO_ERROR;
                 udata_setAppData("OpenOffice", OpenOffice_dat, &status);
-                if ( !U_SUCCESS(status) ) throw uno::RuntimeException();
+                if ( !U_SUCCESS(status) )
+                    throw uno::RuntimeException("udata_setAppData returned 
error " + OUString::createFromAscii(u_errorName(status)));
 
                 std::shared_ptr<OOoRuleBasedBreakIterator> rbi;
 
@@ -273,14 +274,14 @@ void BreakIterator_Unicode::loadICUBreakIterator(const 
css::lang::Locale& rLocal
                         break;
                 }
                 if ( !U_SUCCESS(status) || !pBI ) {
-                    throw uno::RuntimeException();
+                    throw uno::RuntimeException("Failed to create ICU 
BreakIterator: error " + OUString::createFromAscii(u_errorName(status)));
                 }
                 icuBI->mpValue = std::make_shared<BI_ValueData>();
                 icuBI->mpValue->mpBreakIterator = pBI;
                 theBIMap.insert( std::make_pair( aBIMapLocaleTypeKey, 
icuBI->mpValue));
             } while (false);
         if (!icuBI->mpValue || !icuBI->mpValue->mpBreakIterator) {
-            throw uno::RuntimeException();
+            throw uno::RuntimeException("ICU BreakIterator is not properly 
initialized");
         }
         icuBI->maBIMapKey = aBIMapGlobalKey;
         if (!bInMap)
@@ -297,12 +298,12 @@ void BreakIterator_Unicode::loadICUBreakIterator(const 
css::lang::Locale& rLocal
     icuBI->mpValue->mpUt = utext_openUChars(icuBI->mpValue->mpUt, pText, 
rText.getLength(), &status);
 
     if (!U_SUCCESS(status))
-        throw uno::RuntimeException();
+        throw uno::RuntimeException("utext_openUChars returned error " + 
OUString::createFromAscii(u_errorName(status)));
 
     icuBI->mpValue->mpBreakIterator->setText(icuBI->mpValue->mpUt, status);
 
     if (!U_SUCCESS(status))
-        throw uno::RuntimeException();
+        throw uno::RuntimeException("Failed to set text for ICU BreakIterator: 
error " + OUString::createFromAscii(u_errorName(status)));
 
     icuBI->mpValue->maICUText = rText;
 }

Reply via email to