On Error Resume Next - usage and demerits
USAGE
You can add this "On Error Resume Next" to hide any code execution errors to pop-up on your screen
if you know you would get an error in the code block.
You must use "On Error goto 0" to activate error-handling mechanism , after the code of block if finished executing, so that if there any consequent errors in the remaining block of code, you will come to know there are errors.
DEMERITS
It so happened to me , that i used "On Error Resume Next" before
if Data1(i)<>Data2(i) then
so that, my code execution would not stop and happily my code got executed.
But i was unaware that on adding "On Error Resume Next" would really cause me problems.
If there was data or invalid data, you cant compare them, naturally it would throw u error
sayimg "Subscript out of range" or "cant compare with /null"
you should write an exception mechanism to control the flow of execution to get uninterrupted.
Workaround:
Check if your code can handle the error , and if you continously get "Null" values,
and if you are using any resultset or dbconnections, use RS.MoveFirst after Rs.Next loop if any.
Follow this blog to get updated on RESOLVING SOLVING WORKAROUNDS FOR tricky issues using automation.
Disclaimer: I am not responsible for any damage or loss or profit on using this blog posts.
Web UI Automation with Windows PowerShell
Web UI Automation with HP QTP
Web UI Automation with OATS
Web UI Automation with Selenium
Desktop UI Automation
Windows Applications Automation with QTP
qtp windows application automation
Blog Free Travel information in India
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment