【发布时间】:2014-03-21 22:06:10
【问题描述】:
我必须修复一些异常处理代码,其中基本异常没有作为内部异常传递
例如:
Try
SomeFunction()
Catch ex As Exception
If ex.Message = somePreDefinedExceptionMessage Then
LogErrorMsg(ex.Message)
Else
Throw New Exception(ex.Message) //<--- PROBLEM
End Try
如您所见,最初的异常没有继续,我需要它。我需要搜索解决方案中的所有文件并修复与上述示例类似的任何内容。我的问题是如何搜索带有 Throws 的 Catches?这样我就可以查看是否正在传递捕获的异常。
编辑: 为清楚起见,我需要找到与一般模式匹配的任何文本块:
Catch
//bunch of crap
Throw //anything
//potentially more crap (should only be whitespace/newlines)
End Try
【问题讨论】: