This entry is part of a series, Structured Exception Handling in .NET»
Sometimes when you have caught an Exception, you want to do a bit of processing and then throw the Exception on again, or perhaps check the Message property to decide if you can handle it, and if you can’t then you throw it again. This is actually quite easy – you just use Throw, with no parameters.
eg.
Try
DoSomething()
Catch Ex as Exception
If Ex.Message="Connection Failed"
Conn.Reconnect()
Else
Throw
End If
End Try
One thing that you really don’t want to do is to Throw Ex
Entries in this series:
- Structured Exception Handling in .NET Part 1: Try/Catch/Finally
- Structured Exception Handling in .NET Part 2: Multiple Catch Clauses and Different Exception Types
- Structured Exception Handling in .NET Part 3: The Exception Class
- Structured Exception Handling in .NET Part 4: Re-Throwing Exceptions
- Structured Exception Handling in .NET Part 5: Throwing new Exceptions
No related posts.
Tags: .NET, Coding, Structured Exception Handling











