diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-04-10 10:06:23 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-04-10 13:16:23 +0200 |
commit | 4544713d3ae7a83d45047b65bf7ba520b3e8762e (patch) | |
tree | e3fec7e6c16ad7481075222a6bf9e389a8e01af3 /bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx | |
parent | 2ad679b7f6b0b57fb52d4f94f5707765e9a5807e (diff) |
Adapt remaining cpp_uno bridges to #i114635#
..."C++ UNO bridge should convert non-UNO exceptions into RuntimeException"
(<https://bz.apache.org/ooo/show_bug.cgi?id=114635>), see
<https://lists.freedesktop.org/archives/libreoffice/2018-April/079985.html>
"Re: CppunitTest_sw_filters_test failing on x86 Linux, std::exception ->
uno::RuntimeException".
(The msvc_win32_{intel,x86-64} versions already handle non-UNO exceptions in
their msc{i,x}_filterCppException functions, in a different way.)
Change-Id: Ie359affed6831d16be0de3e3ff065484e28bd9c3
Reviewed-on: https://gerrit.libreoffice.org/52665
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx')
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx index 8e40d003f03c..e7354a4ba8c5 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx @@ -17,10 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> +#include <exception> #include <malloc.h> +#include <typeinfo> +#include <com/sun/star/uno/Exception.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> #include <com/sun/star/uno/genfunc.hxx> +#include <o3tl/runtimetooustring.hxx> #include <uno/data.h> #include "bridge.hxx" @@ -328,12 +334,22 @@ static void cpp_call( try { - callVirtualMethod( - pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeDescr, - pStackStart, (pStack - pStackStart), - pGPR, nGPR, - pFPR, nFPR ); + try { + callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeDescr, + pStackStart, (pStack - pStackStart), + pGPR, nGPR, + pFPR, nFPR ); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; |