asp-classicerror-handling

On Error Goto throws error


There are similar questions about On Error Goto x not catching all errors etc, but I've encountered a different problem.

My (Classic ASP) page works fine, most of the time. Some users complain of an error on the page, couldn't duplicate yet.

I tried error handling but On Error Resume Next does not help me with this situation and On Error Goto causes the page not to work and constantly throw an error (which looks like a 500, but that might be because of handling IIS is doing in background). It happens whether I write Goto 0 or Goto [label] without a difference if the label exists or not.

What might be causing this?


Solution

  • On Error GoTo label is not supported in ASP

    you begin an error trapping block using

    On Error Resume Next ,

    check Err.Number to see if an error occurred,

    close the block using

    On Error GoTo 0.

    See also: this post