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.bergmann@allotropia.de>
This commit is contained in:
@@ -112,6 +112,7 @@ interface XTest {
|
||||
boolean isSequenceEnum([in] sequence<Enum> value);
|
||||
sequence<Struct> getSequenceStruct();
|
||||
boolean isSequenceStruct([in] sequence<Struct> value);
|
||||
void throwRuntimeException();
|
||||
};
|
||||
|
||||
}; }; };
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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: */
|
||||
|
||||
Reference in New Issue
Block a user