How to Automatically re-raise Exceptions
Posted
by Brian
on Stack Overflow
See other posts from Stack Overflow
or by Brian
Published on 2010-04-08T20:00:23Z
Indexed on
2010/04/08
20:03 UTC
Read the original article
Hit count: 396
If you wrap a call to HttpResponse.End
within a try catch block, the ThreadAbortException
would automatically be re-raised. I assume this is the case even if you wrap the try catch block in a try catch block.
How can I accomplish the same thing? I do not have a real-world application for this.
namespace Program
{
class ReJoice
{
public void End() //This does not automatically re-raise the exception if caught.
{
throw new Exception();
}
}
class Program
{
static void Main(string[] args)
{
try
{
ReJoice x = new ReJoice();
x.End();
}
catch (Exception e) {}
}
}
}
© Stack Overflow or respective owner