We have a very large code base of VB code that was written simply because it's easier to get a working prototype in vb (pre 2010 and c# runtime code editing), and the prototypes turned into production code...
D
DragonLord66
@DragonLord66
Posts
-
a try inside another -
a try inside anotherSorry, I'll use Smalltalk next time. More seriously I had a vb editor open so it was just quicker to type it in there with the auto complete than to start up a new c# editor for the example (formatting purposes)
-
a try inside anotherIf you're in a helper layer such as a DAL then you don't want to add any code that will interact with the user, however you may want to do clean up before the exception is thrown up the chain to a level where the exception can be dealt with by the user. Equally what's the difference between the original example and the following?
Private Sub ExceptionMethod() Try DoExceptionCode() Finally DoCleanup() End Try End Sub Private Sub ExceptionHandlerCode() Try ExceptionMethod() Catch ex As Exception ExceptionHandlerHere() End Try End Sub