udkapi/org/libreoffice/embindtest/XTest.idl |    1 +
 unotest/source/embindtest/embindtest.cxx    |    6 ++++++
 unotest/source/embindtest/embindtest.js     |    7 +++++++
 3 files changed, 14 insertions(+)

New commits:
commit 74b48a8f6e6c861ee791107c9cacd7a9f6b84904
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Mon Apr 8 11:34:05 2024 +0200
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Mon Apr 8 12:59:00 2024 +0200

    Embind: Clarify poor UNO exception support
    
    As UNO exceptions are not derived from std::exception in C++, the 
corresponding
    JS object's name property is present but has undefined value.  And the UNO
    Message property is not present at all.
    
    Change-Id: Ibe152377e5970faa8a518c77b5171d9f3c160f38
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165885
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>

diff --git a/udkapi/org/libreoffice/embindtest/XTest.idl 
b/udkapi/org/libreoffice/embindtest/XTest.idl
index 45042663cf47..b3b5237ce2b4 100644
--- a/udkapi/org/libreoffice/embindtest/XTest.idl
+++ b/udkapi/org/libreoffice/embindtest/XTest.idl
@@ -112,6 +112,7 @@ interface XTest {
     boolean isSequenceEnum([in] sequence<Enum> value);
     sequence<Struct> getSequenceStruct();
     boolean isSequenceStruct([in] sequence<Struct> value);
+    void throwRuntimeException();
 };
 
 }; }; };
diff --git a/unotest/source/embindtest/embindtest.cxx 
b/unotest/source/embindtest/embindtest.cxx
index d437f3907e3a..39ba4c839dae 100644
--- a/unotest/source/embindtest/embindtest.cxx
+++ b/unotest/source/embindtest/embindtest.cxx
@@ -11,6 +11,7 @@
 
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/uno/Type.hxx>
 #include <cppu/unotype.hxx>
@@ -496,6 +497,11 @@ class Test : public 
cppu::WeakImplHelper<org::libreoffice::embindtest::XTest>
                       { 123456, 100.75, u"bazzz"_ustr }
                   };
     }
+
+    void SAL_CALL throwRuntimeException() override
+    {
+        throw css::uno::RuntimeException(u"test"_ustr);
+    }
 };
 }
 
diff --git a/unotest/source/embindtest/embindtest.js 
b/unotest/source/embindtest/embindtest.js
index 1b0cf8eb5fc6..410b3886be6d 100644
--- a/unotest/source/embindtest/embindtest.js
+++ b/unotest/source/embindtest/embindtest.js
@@ -537,6 +537,13 @@ Module.addOnPostRun(function() {
     
console.assert(test.isFloat(uno.org.libreoffice.embindtest.Constants.Float));
     console.assert(uno.org.libreoffice.embindtest.Constants.Double === 100.5);
     
console.assert(test.isDouble(uno.org.libreoffice.embindtest.Constants.Double));
+    try {
+        test.throwRuntimeException();
+   } catch (e) {
+       console.assert(e.name === 'com::sun::star::uno::RuntimeException');
+       console.assert(e.message === undefined); //TODO
+       //TODO: console.assert(e.Message.startsWith('test'));
+   }
 });
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */

Reply via email to