Let's say we have a structure like so:
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
I have seen some opinions that nesting Try
blocks like this is discouraged, but I could not find any specific reasons.
Is this bad code? If so, why?
See Question&Answers more detail:os