gus
11 years agoContributor
Can't access exception properties shown in Locals
I've came across this strange situation: I catch an exception to write its details to a log entry, but in the log entry I can see undefined instead of the attribute values expected and shown in the Locals window.
The portion of the code:
try {
fso.CreateTextFile(fullname);
return path;
} catch (x) { // Something went wrong
// Because exception forwarding between modules is not reliable in TC,
// and this method is usually called from other modules, let's create
// a log entry and an error code instead.
Log.Error("File creation error",
"Could not create [" + fullname + "] because of an error named [" + x.Name + "]\r\n\r\nDetails: " + x.Message,
pmNormal);
return "";
}If you take a look at Locals.png, you'll see the exception object's attributes contain legitime values. However the log shows what you can see in Log.png. What am I missing?
JScript is case-sensitive:
x.Name --> x.name
x.Message --> x.message