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>
This commit is contained in:
Ankit_Jaipuriar 2023-09-24 11:49:28 +05:30 committed by Mike Kaganski
parent 9bc2aede99
commit a97ceaf14e

View file

@ -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;
}