on error go to x
正常代码
exit sub
x:
错误处理代码
resume y: 或 resume next 或resume //处理错误之后,执行什么动作
- on error go to x,发生错误跳到x:执行
- exit sub ,防止无错误也执行
- resume y: 跳到y处执行
- resume next 继续执行发生错误处的下一句
- resume 继续执行发生错误的语句
- on error resume next 与 on error go to 0搭配,表示resume next错误忽略的范围至 on error go to 0结束
这篇博客探讨了VBScript中的错误处理代码,如onerror goto x,exitsub,以及resumey、resumenext和resume等指令的使用。文章详细解释了如何在错误发生时跳转到错误处理代码,并在处理后决定执行的路径,例如继续执行、跳过错误或从错误处恢复。同时,还介绍了onerrorresumenext与onerrorgoto0的组合用法,用于指定错误忽略的范围。

2928

被折叠的 条评论
为什么被折叠?



