Forum Discussion

mizukithps's avatar
mizukithps
New Contributor
11 years ago

Save a Log Error for later

Hi I am using JScript in Test Complete 9 and I was wondering if there was a way to Log an error, remove the error from the log, and then decide again later if you want to re-enable it. I have found the OnLogError Event Handler and can use LogParams.Locked set to true to make it so the error does not get posted to the log, but I am not sure how to go about re-enabling it later. Getting the LogParams object out and then changing the value back to false later does not make the Error appear. I was wondering if there was any other methods available to do this.

3 Replies

  • jose_pita's avatar
    jose_pita
    Super Contributor
    You can try to use this but I'm pretty sure you can't "save it for later", unless there's a way to save a piece of log to a variable and write it to the log later...
  • mizukithps's avatar
    mizukithps
    New Contributor
    Yeah that link doesn'tt really help, and the idea you had about saving the Log to an object, or maybe there is a property on rows in the log that let you disable re-enable them.



    The problem is there is a master catch statement outside of the script where the Error occurs, that makes a decision on if the Error needs to be logged, or if it was expected to happen such as in negative testing. The reason I don't want to log in the catch statement is then I lose the stack trace to where the Error actually happened. Right now I am just attaching the script name to an Error object, and printing that in text form when I log the Error in the master catch. The stack trace for every error therefore always points to the exact same spot.



    But maybe there is no real solution for this.
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Robert,



    > [...] I lose the stack trace to where the Error actually happened.

    Have you tried, with the error record been selected in the Log, to open the Call Stack Log panel? Usually, it contains the complete call stack and by double-clicking its records it is possible to navigate through the execution path.