My code looks like this
var i = 0;
try
{
i = faultyProcedure();
}
catch (Exception ex)
{
try
{
throw new CustomException("faultyProcedure called", ex);
}
catch (CustomException) {}
}
Though it works, it looks silly. The custom exception does all the logging, mailing, etc. even exits the application if necessary.
Is there a way for the custom exception to catch/kill itself, so there is no need for the inner try/catch block?