Ask a Question

Can't access exception properties shown in Locals

SOLVED
gus
Contributor

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?

2 REPLIES 2
HKosova
SmartBear Alumni (Retired)

 JScript is case-sensitive:

x.Name --> x.name

x.Message --> x.message


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

Oh God! Thanks for correcting me. It was so great to enjoy full intellisense in TC. 🙂

cancel
Showing results for 
Search instead for 
Did you mean: