VBS 自定义Err操作

阅读更多
Option Explicit


on error resume next

set a = new classA
msgbox a.hehe

if err.number <> 0 then
if err.number = -2147220504 then
msgbox "catch it"
err.clear
end if

wscript.echo "out err =" & err.number & ", " & err.description
msgbox "come here"

end if

if err.number <> 0 then
wscript.echo err.description
end if


class classA
public var


Private Sub Class_Initialize
var = "ccd"
End Sub

Private Sub Class_Terminate
' Called automatically when all references to class instance are removed
End Sub

public function hehe
on error resume next
dim a
a= 1/0

if err.number <> 0 then
wscript.echo "in error =" & err.number & ", " & err.description
err.raise vbObjectError+1000,"4444","eeee"
end if

hehe = "sfsdfsd"
end function

private sub display

end sub

End Class

你可能感兴趣的:(vbs,err,raise)