Imports System
Public Class MainClass
Shared Sub Main(ByVal args As String())
Console.WriteLine("Calling ThrowExceptionCatchRethrow")
Try
ThrowExceptionCatchRethrow()
Catch
Console.WriteLine("Caught exception from " & _
"ThrowExceptionCatchRethrow in Main")
End Try
End Sub
Public Shared Sub ThrowExceptionCatchRethrow()
Try
Console.WriteLine("In ThrowExceptionCatchRethrow")
Throw New Exception("Exception in ThrowExceptionCatchRethrow")
Catch exceptionParameter As Exception
Console.WriteLine("Message: " & exceptionParameter.Message)
Throw exceptionParameter
Finally
Console.WriteLine("Finally executed in ThrowException")
End Try
' any code placed here is never reached
Console.WriteLine("End of ThrowExceptionCatchRethrow")
End Sub
End Class
|