0

Possible Duplicate:
.NET - Throwing Exceptions best practices

Hi,

I have seen people re-throwing exceptions as given below. which one is optimal? Why one mechanism is optimal than the other one.

try
{
   // do something
}
catch (exception ex)
{
   // do something
   throw ex;
}

try
{
    // do something
}
catch (exception ex)
{
   // do something
   throw;
}
Community
  • 1
  • 1
Maanu
  • 5,093
  • 11
  • 59
  • 82
  • Same as [ .NET - Throwing Exceptions best practices ](http://stackoverflow.com/questions/22623/net-throwing-exceptions-best-practices). – Matthew Flaschen Aug 15 '10 at 04:50

1 Answers1

0

well, I don't know about others, but sometimes we do the second method to log the error and then catch it somewhere else.

Muad'Dib
  • 28,542
  • 5
  • 55
  • 68