What does "on error goto 0" and "error resume next" mean in the old ASP?

I am working with old ASP code, and I am not sure about the semantics of building on error goto 0and error resume next.

Can you recommend me some useful resources or instruct me directly?

+5
source share
5 answers

In case of an error, repeat the following: if there is an exception in the program, just ignore it and proceed to the next statement. It is considered very bad and ugly, and rightly so, in my opinion. It looks like a big one:

try
{
  // your code
}
catch
{
  // nothing! muhaha
}

in every method of your code (or, worse, around the whole program).

goto 0: , . , , .

. MSDN.

+4

, . , - .

. . , 100 , , - .

+3

on error resume next on error goto 0 :

     <%
        on error resume next '<-- This code will resume and continue executing the code if there is an error



'YOUR CODE HERE

if err.number > 0 then  '<-- This code will look if there are any errors (even if resumed)
' or use If Err.Number <> 0 Then


        'DO SOMETHING IF ERROR
    %>
        Error Number <%= Err.Number %><BR>
        Error Description <%= Err.Description %><BR>        
        Source <%= Err.Source %><BR>

        LineNumber <%= Err.Line %><BR>

        <%end if%>
+3

" " Do Loops ASP, . (?) "On Error Resume Next", , . : , , (), , , , .

See the Larry answer provided for a similar question for a quick example of this. How to handle errors in VB Script

+1
source

All Articles