I am working with old ASP code and I am not sure about semantics of on error goto 0
and error resume next
construction.
Can you recommend me some useful resources or enlight me directly?
I am working with old ASP code and I am not sure about semantics of on error goto 0
and error resume next
construction.
Can you recommend me some useful resources or enlight me directly?
Have a look here: http://www.powerasp.com/content/new/on-error-resume-next.asp
On error resume next: If there is an exception in the program, just ignore it and continue to the next statement. Considered very bad and ugly, and rightly so in my opinion. It's like having a big:
try
{
// your code
}
catch
{
// nothing! muhaha
}
in every method of your code (or worse, around the whole program).
On error goto 0: disables any error handler that is defined in the current procedure. It's like having a big try-catch around your code, which gets disabled as soon as its hit this line.
For more information, see the MSDN.
on error go to takes the execution code to a specific code book mark defined in the page.this is useful when you want to perform anything in case an error is encountered.
On error resume next moves on to the next code of execution after the erroneous code. Basically ignores the error and continues with the code. This is particulary useful when you are processing 100s of records and don't want the code to stop execution in case any record throws up error.