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.kaganski@collabora.com>
diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx
index 7e19e86..4927a82 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;
}