summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2020-05-05 19:18:56 +0300
committerMichael Meeks <michael.meeks@collabora.com>2020-05-14 17:39:37 +0100
commit846e14e6b520f0b4ed79801f58d7335fe0573558 (patch)
treec0fedaad91924c9b833517b7665fdde169bb821d /i18npool
parent411fe777a8d3439cac2bc9c4f45162630e7a3cdc (diff)
Throw exceptions with useful messages
Change-Id: Ic8e09d31db97c0cf2e1aaf006c96481d12deb2d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93506 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tor Lillqvist <tml@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93592 Tested-by: Jenkins
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/collator/collator_unicode.cxx26
1 files changed, 22 insertions, 4 deletions
diff --git a/i18npool/source/collator/collator_unicode.cxx b/i18npool/source/collator/collator_unicode.cxx
index e2aee8282541..7530e5d2f6f1 100644
--- a/i18npool/source/collator/collator_unicode.cxx
+++ b/i18npool/source/collator/collator_unicode.cxx
@@ -19,6 +19,8 @@
#include <config_locales.h>
+#include <sal/log.hxx>
+
#include <lrl_include.hxx>
#include <rtl/ustrbuf.hxx>
@@ -140,7 +142,11 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
OUString rule = LocaleDataImpl::get()->getCollatorRuleByAlgorithm(rLocale, rAlgorithm);
if (!rule.isEmpty()) {
collator.reset( new icu::RuleBasedCollator(reinterpret_cast<const UChar *>(rule.getStr()), status) );
- if (! U_SUCCESS(status)) throw RuntimeException();
+ if (! U_SUCCESS(status)) {
+ OUString message = "icu::RuleBasedCollator ctor failed: " + OUString::createFromAscii(u_errorName(status));
+ SAL_WARN("i18npool", message);
+ throw RuntimeException(message);
+ }
}
if (!collator && OUString(LOCAL_RULE_LANGS).indexOf(rLocale.Language) >= 0) {
const sal_uInt8* (*func)() = nullptr;
@@ -358,10 +364,18 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
uca_base.reset( static_cast<icu::RuleBasedCollator*>(icu::Collator::createInstance(
icu::Locale::getRoot(), status)) );
#endif
- if (! U_SUCCESS(status)) throw RuntimeException();
+ if (! U_SUCCESS(status)) {
+ OUString message = "icu::Collator::createInstance() failed: " + OUString::createFromAscii(u_errorName(status));
+ SAL_WARN("i18npool", message);
+ throw RuntimeException(message);
+ }
collator.reset( new icu::RuleBasedCollator(
reinterpret_cast<const uint8_t*>(ruleImage), ruleImageSize, uca_base.get(), status) );
- if (! U_SUCCESS(status)) throw RuntimeException();
+ if (! U_SUCCESS(status)) {
+ OUString message = "icu::RuleBasedCollator ctor failed: " + OUString::createFromAscii(u_errorName(status));
+ SAL_WARN("i18npool", message);
+ throw RuntimeException(message);
+ }
}
}
if (!collator) {
@@ -382,7 +396,11 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
// load ICU collator
collator.reset( static_cast<icu::RuleBasedCollator*>( icu::Collator::createInstance(icuLocale, status) ) );
- if (! U_SUCCESS(status)) throw RuntimeException();
+ if (! U_SUCCESS(status)) {
+ OUString message = "icu::Collator::createInstance() failed: " + OUString::createFromAscii(u_errorName(status));
+ SAL_WARN("i18npool", message);
+ throw RuntimeException(message);
+ }
}
}