Skip to content

Instantly share code, notes, and snippets.

@friskfly
Created January 9, 2013 07:29
Show Gist options
  • Save friskfly/4491335 to your computer and use it in GitHub Desktop.
Save friskfly/4491335 to your computer and use it in GitHub Desktop.
asp 异常机制
<%
Dim myVar
On Error Resume Next
'下面一行代码会在MSXML 4.0没有被安装或者已经损坏的情况下产生错误
Set myVar = Server.CreateObject("MSXML2.DOMDocument.4.0")
If Err.Number <> 0 Then
' 在这里处理错误
' 结束错误处理,避免以后发生的错误无法被发现
On Error GoTo 0
Else
' myVar 现在指向 MSXML 4.0 DOMDocument的一个实例
' 结束错误处理,避免以后发生的错误无法被发现
On Error GoTo 0
End If
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment