Try-Catch-End Try in VBScript doesn't seem to work

前端 未结 4 678
北荒
北荒 2020-12-24 06:51

I\'m trying the following code:

Try \' DOESN\'T WORK
    Throw 2 \' How do I throw an exception?
Catch ex
    \'What do I do here?
End Try
         


        
4条回答
  •  北海茫月
    2020-12-24 07:25

    VBScript doesn't have Try/Catch. (VBScript language reference. If it had Try, it would be listed in the Statements section.)

    On Error Resume Next is the only error handling in VBScript. Sorry. If you want try/catch, JScript is an option. It's supported everywhere that VBScript is and has the same capabilities.

提交回复
热议问题