vb.net – 异常后继续代码
发布时间:2020-12-17 00:22:02 所属栏目:大数据 来源:网络整理
导读:我想知道是否有办法让程序在抛出异常后继续.例如: Try line 1 line 2 line 3 line 4 ( here the exception is thrown and jumps to the catch) line 5 -- i would like the program to continue its execution loging the error line 6 Catch ex as Excepti
我想知道是否有办法让程序在抛出异常后继续.例如:
Try line 1 line 2 line 3 line 4 ( here the exception is thrown and jumps to the catch) line 5 <-- i would like the program to continue its execution loging the error line 6 Catch ex as Exception log(ex.tostring) End Try 谢谢.
如果你正在做一些你知道如何恢复或者不重要的事情,那么你应该在try / catch中用特定的catch来包装那一行.
例如 Try line 1 line 2 line 3 Try line 4 ( here the exception is throw and jumps to the catch) Catch iox as IOException ' or whatever type is being thrown 'log it End Try line 5 <-- i would like the program to continue its execution after loggin the error line 6 Catch ex as Exception log(ex.tostring) End Try (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |