From 80cc772841dc3b03f0a629215858d0a44f5419a1 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 20 Dec 2011 10:00:36 +0000 Subject: pretty up exception message for display in StarBasic dialogs --- framework/source/loadenv/loadenv.cxx | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'framework') diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index ef6515292390..090b6aa87ed2 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -193,24 +193,32 @@ css::uno::Reference< css::lang::XComponent > LoadEnv::loadComponentFromURL(const switch(ex.m_nID) { case LoadEnvException::ID_INVALID_MEDIADESCRIPTOR: - throw css::lang::IllegalArgumentException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Optional list of arguments seem to be corrupted.")), - xLoader, - 4); + throw css::lang::IllegalArgumentException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Optional list of arguments seem to be corrupted.")), + xLoader, + 4); case LoadEnvException::ID_UNSUPPORTED_CONTENT: - throw css::lang::IllegalArgumentException( - (rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("Unsupported URL <")) + - sURL + - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(">: \"")) + - rtl::OStringToOUString( - ex.m_sMessage, RTL_TEXTENCODING_UTF8) + - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\""))), + { + rtl::OUStringBuffer aMsg; + aMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM("Unsupported URL <")). + append(sURL).append('>'); + + if (!ex.m_sMessage.isEmpty()) + { + aMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM(": \"")). + append(rtl::OStringToOUString( + ex.m_sMessage, RTL_TEXTENCODING_UTF8)). + appendAscii(RTL_CONSTASCII_STRINGPARAM("\"")); + } + + throw css::lang::IllegalArgumentException(aMsg.makeStringAndClear(), xLoader, 1); + } - default: xComponent.clear(); - break; + default: + xComponent.clear(); + break; } } -- cgit