Pas2JS: showException with stack trace for RTL Exception object

This commit is contained in:
Ondrej Pokorny 2024-12-09 16:43:39 +00:00 committed by Michael Van Canneyt
parent 63a2a4d9e7
commit 96cb3b01de

View File

@ -155,7 +155,13 @@ var rtl = {
},
showException : function (re) {
var errStack = (re.hasOwnProperty('stack')) ? re.stack : re;
var errStack="";
if (rtl.isObject(re) && re.hasOwnProperty('FJSError') && rtl.isObject(re.FJSError) && !(re.FJSError.stack==undefined)) // rtl Exception
errStack=re.FJSError.stack
else if (rtl.isObject(re) && re.hasOwnProperty('stack') && !(re.stack==undefined)) // native JS Error
errStack=re.stack
else
errStack=re; // unknown object
var errMsg = rtl.hasString(re.$classname) ? re.$classname : '';
errMsg += ((errMsg) ? ': ' : '') + (re.hasOwnProperty('fMessage') ? re.fMessage : '');
errMsg += ((errMsg) ? "\n" : '') + errStack;