假设我们有这样的结构:
Try
' Outer try code, that can fail with more generic conditions,
' that I know less about and might not be able to handle
Try
' Inner try code, that can fail with more specific conditions,
' that I probably know more about, and are likely to handle appropriately
Catch innerEx as Exception
' Handle the inner exception
End Try
Catch outerEx as Exception
' Handle outer exception
End Try
Run Code Online (Sandbox Code Playgroud)
我已经看到一些意见认为这样的嵌套Try块是不鼓励的,但我找不到任何具体的原因.
这是坏代码吗?如果是这样,为什么?