Error on On Error routine - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: Error on On Error routine (/Thread-Error-on-On-Error-routine) |
Error on On Error routine - upadhyay40 - 12-23-2009 Hello All, I am trying to implement On Error Resume Next in my code but i got error on 2 line The test run cannot continue due to a syntax error. Syntax error Line (1): Code: "On Error GoTo ErrorHandler: ' Enable error-handling routine.". can any body please help me out to solve my problem. My Code: Code: Public Sub OnErrorDemo() Thanks Mahesh RE: Error on On Error routine - Saket - 12-24-2009 Hi Mahesh, 'On Error GoTo ErrorHandler' is not supported in QTP so you can not use the statement here. you can use only 'on error resume next' or 'on error goto 0' @Everyone - Please put your codes in proper tags, which makes easier to read through all the statements. Refer Help (top right of this page) RE: Error on On Error routine - jsknight1969 - 12-29-2009 You can use the Err object in an if/case statement to handle error. Code: on error resume next I created a class to handle error and enhanced the class with a DLL written in .NET to store to eventlog, file, or database. You don't need .NET for file or database, I just prefer the eventlog and could write it easily in .NET. To use the class just replace the case statement with a sub call and pass the err object. |