I am trying to get the stack trace (and other details) when an exception occurs in my code. To do this the following piece of code use to work:
function catchException() {
var errLog = [];
try {
var temp;
temp.split(",");
} catch (exception) {
for (var property in exception) {
errLog.push(property + ": " + exception[property]);
}
}
return errLog;
}
But ever since the v8 runtime update on Google Apps Script, this doesn't return any property of the exception object.
In v8 runtime, I can get the stack trace in the above code, if I use exception["stack"]
, I get the stack trace.
But I was hoping I could avoid using the string ("stack"
) and also get all the other properties of the exception for which I might not know the property name.
The for...in
loop doesn't seem to be working in this scenario.
How can I access the exception object's properties?
(all the properties without using the property names)