first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

VBScript and ASP Code: In-Line Error Handling with Resume Next

'VBScript only has "in-line" error handling. 'The Resume Next keywords do work 'in the latest versions of VBScript. 'Recall that there are no line labels in VBScript. 'I have, however, seen some code using line numbers '---especially line zero (e.g. On Error Goto 0). 'According to Microsoft, the Err object has existed 'since version 1.0 of VBScript. 'This is the general form of the VBScript error handler 'using Resume Next:

On Error Resume Next
'Line(s) of code to trap go here.
If Err.number <> 0 Then
    Response.Write Err.Number & ": " & Err.Description
    Response.End
    Err.Clear
End If

'Alternatively, there is the Select-Case form:

On Error Resume Next
'Line(s) of code to trap go here.
Select Case Err.number
    Case 0
        'No error. Continue.
    Case Else
        Response.Write Err.Number & ": " & Err.Description
        Response.End
        Err.Clear
End Select
mod date: 1999-03-13T01:40:16.000Z