js: fix extracting exception message from Java

This commit is contained in:
Alexey Andreev 2023-04-11 13:42:14 +02:00
parent 6e90124edd
commit b927b28e7d

View File

@ -714,14 +714,18 @@ if (typeof Reflect === 'object') {
}, },
message: { message: {
get: function() { get: function() {
try {
var javaException = this[$rt_javaExceptionProp]; var javaException = this[$rt_javaExceptionProp];
if (typeof javaException === 'object') { if (typeof javaException === 'object') {
var javaMessage = $rt_throwableMessage(javaException); var javaMessage = $rt_throwableMessage(javaException);
if (typeof javaMessage === "object") { if (typeof javaMessage === "object") {
return javaMessage.toString(); return javaMessage !== null ? javaMessage.toString() : null;
} }
} }
return this[defaultMessage]; return this[defaultMessage];
} catch (e) {
return "Exception occurred trying to extract Java exception message: " + e
}
} }
} }
}); });